% function p2c_tst1 % needs to write in the workspace
% Feb 2016, J. Gaspar

A= [0 1; -1 -1];
%A= [0 1; -1 -.1]; % low damping, large oscillation
%A= [0 1; -1 -2];  % high damping, small oscillations
B= [0; 1];
C= eye(2);
D= [0; 0];
x0= [1; 0];

th= (0:45:360)*pi/180;
x0n= [cos(th); sin(th)];
figure(201); clf; hold on
for i=1:size(x0n,2)
    x0= x0n(:,i);
    [t,x,y] = sim('p2c'); % simulation (simulink p2c.mdl gets A,B,C,D,x0)
    plot(y(:,1),y(:,2))
end
axis equal
grid on

% draw over the previous test
p2c_tst0
