echo on
% SUSPGRPH Runs simulation and plots graphs for vehicle suspension model.

x0=trim('suspn');   % find equilibrium state for simulation initial conditions
[t,x]=rk45('suspn',10,x0);  % run a time response

% Plot graphs
tt=[0:0.01:t(length(t))];
figure(1)
subplot(5,1,1), plot(tt,THETAdot), ylabel('THETAdot')
subplot(5,1,2), plot(tt,Zdot), ylabel('Zdot') 
subplot(5,1,3), plot(tt,ForceF), ylabel('Ff')
text(0.5,6500,'reaction force at front wheels')
subplot(5,1,4), plot(tt, h), ylabel('h'), set(gca,'Ylim',[-0.005 0.015]);
text(0.5,0.005 ,'road height')
subplot(5,1,5), plot(tt, Y), ylabel('Y'), set(gca,'Ylim',[-20 120]);
text(3.5,70,'moment due to vehicle accel/decel')
xlabel('time in seconds')
echo off

% For hardcopy
%set(gcf,'Paperposition',[0.25 2.5 5 6]);
%print -deps suspn.eps
