function [z]=S0(x)
    z=A0*x+b0;
endfunction

function [z]=S1(x)
    z=A1*x+b1;
endfunction


A0=[0.4 -0.373; 0.06 0.6];
b0=[0.3533 ; 0];
A1=[-0.8 -0.1867 ; 0.1371 0.8];
b1=[1.1 ; 0.1];

x=[0;0];
N=10000;
clf();
for i=1:N
    eps=grand(1,1,'bin',1,0.2993);
    if (eps==1) then
        x=S1(x);
    else
        x=S0(x);
    end
    plot(x(1),x(2),'r.',"MarkerSize",1);
end
