%
% Equilibrium points
%
% This example uses the inverted pendulum to illustrate multiple equilibrium
% points.
%

aminit;					% initialize MATALB

fprintf(2, 'Equilibrium points...'); 

m = 1; l = 1; b = 0.2; g = 1;		% parameters for undamped pendulum

figure(1); clf; subplot('position', [0.13, 0.6, 0.375 0.375]);

% Set up the axes (since we won't use autoscaling)
set(gca, 'DataAspectRatio',[5,3,1]);
amaxis([-2*pi 2*pi -2.1 2.1]);

% Outer trajectories
hold on; [axish, lineh] = amphaseplot('invpend', ...
   'timepts', [1 4 10], nan, ...
   [-2*pi 1.6; -2*pi 0.5; -1.8 2.1; -1 2.1; 4.2 2.1; 5 2.1; ...
     2*pi -1.6; 2*pi -0.5; 1.8 -2.1; 1 -2.1; -4.2 -2.1; -5 -2.1], ...
   [0:0.05:40], m, l, b, g);
set(lineh, 'Color', [0.3 0.3 1]);

% Separatrices
amphaseplot('invpend', 'auto', 0, nan, [-2.3056 2.1; 2.3056 -2.1], 10, m, l, b, g);

% a=gca; set(a,'FontSize', 16);
xlabel('x1'); 
ylabel('x2', 'Rotation', 0);

% Reset the tick marks
set(gca, 'XTick', [-2*pi -pi 0 pi 2*pi]);
set(gca, 'XTickLabel', {'-2pi', '-pi', '0', 'pi', '2pi'});
 
% add the equilibrium points
hold on; plot([-6.283 -pi 0 pi 6.283], [0 0 0 0 0], 'k.', ...
  'MarkerSize', AM_data_markersize*3);

% print -dmeta equilibria.wmf
amprint('invpendpp.eps');



