%
% dinvpend.m - damped inverted pendulum
% RMM, 6 Sep 06
%

aminit;					% initialize MATALB

% First generate a phase plot for an inverted pendulum with damping
m = 1; l = 1; b = 0.2; g = 1;		% parameters for damped pendulum

figure(1); clf; subplot(211);
% [-2*pi 2*pi 20], [-2 2 10], ...
amphaseplot('invpend', ...
   'logtime', [10, 0.5], 0.5, ...
   [-2*pi,0.5; -2*pi,1.4; -2*pi, 2.7; -2*pi,3.2; ...
    -2*pi,3.6; -2*pi,4; -2*pi,4.5; -2.1356771,2; ...
    2*pi,-0.5; 2*pi,-1.4; 2*pi,-2.7; 2*pi,-3.2; ...
    2*pi,-3.6; 2*pi,-4; 2*pi,-4.5; 2.1356771,-2], 50, ...
   m, l, b, g);
amaxis([-2*pi 2*pi -2 2]);

% Reset the aspect ratio to work better in the figure
a=gca; set(a,'DataAspectRatio',[5,3,1]);
xlabel('x1'); ylabel('x2');

amprint('invpend-dampedpp.eps');
