function traj(A);
% traj(A)
% plot trajectories of xdot = A*x, where A is 2x2
    %figure
    N=100;dt=.2;
    phi=expm(A*dt);
    iphi=inv(phi);
    hold on
    theta=[0:2*pi/50:2*pi];
    plot(cos(theta),sin(theta),'k')
    y=zeros(2,N+1);
    for theta=[0:pi/12:pi-.001]
        for m=[1:2]
            color = 'b';if m==2, color='r';end
            EA=(m==1)*phi+(m==2)*iphi;
            x=[cos(theta),sin(theta)]';
            test=1;count=1;
            while test
                y(:,count)=x;
                x=EA*x;
                test=(abs(x(1))<2)&(abs(x(2))<2)&(x'*x>.005)&(count<N);
                count=count+1;
            end
            k=[1:count-1];
            y1=[y(1,k),x(1)];
            y2=[y(2,k),x(2)];
            plot(y1,y2,color)
            plot(-y1,-y2,color)
        end
	end
    hold off
    axis('equal')
    axis('square')
    %axis('off')
    axis(2.0*[-1 1 -1 1]);

