%
% Systems of ODEs: damped oscillator example (simulation + phase portrait)
% 

aminit;					% initialize MATALB

% Generate a vector plot for the damped oscillator
figure(1); clf; subplot(221);
amphaseplot('oscillator', [-1 1 10], [-1 1 10], 0.15);
hold on; plot([0], [0], '.', 'MarkerSize', 12);
% a=gca; set(a,'FontSize',20); set(a,'DataAspectRatio',[1,1,1]);
xlabel('x1'); ylabel('x2','Rotation',0);

amprint('doscvf.eps');


% Generate a phase plot for the damped oscillator
figure(2); clf; subplot(221);
amaxis([-1 1 -1 1]); set(gca, 'DataAspectRatio', [1, 1, 1]);
amphaseplot('oscillator', ...
  'timepts', [0.25 0.8 2 3], nan, [ ...
  -1 1; -0.3 1; 0 1; 0.25 1; 0.5 1; 0.75 1; 1 1; ...
  1 -1; 0.3 -1; 0 -1; -0.25 -1; -0.5 -1; -0.75 -1; -1 -1 ...
  ], [0:0.01:8]);
hold on; plot([0], [0], 'k.', 'MarkerSize', AM_data_markersize*3);
% set(gca,'DataAspectRatio',[1,1,1]);
xlabel('x1'); ylabel('x2','Rotation', 0);

amprint('doscpp.eps');

