
A=[-5 4; -2 1];
B=[0 2; 5 -3];
C=[1 9; -2 -5];

MAT=B;
N=100;
cla;

T=2;
xmin=-1.3; xmax=-xmin;
ymin=-1; ymax=-ymin;
axis([xmin xmax ymin ymax]);
set(gca,'box','on');
h=line(0,0);
set(h,'Marker','o','markerfacecolor','red');
[x0,y0]=ginput(1);
inside=(xmax-x0)*(x0-xmin)*(ymax-y0)*(y0-ymin)>0;
while inside
    yp=mysolve(MAT,[x0;y0],T,N);
    yp=yp(:,2:end);
    ym=mysolve(-MAT,[x0;y0],T,N);
    ym=fliplr(ym);
    y=[ym yp];
    line(y(1,:),y(2,:));
    [x0,y0]=ginput(1);
    inside=(xmax-x0)*(x0-xmin)*(ymax-y0)*(y0-ymin)>0;
end;