% System Parameters: 'Time, S' 'Position, M'
% System Parameters: 'Time, S' 'Position, M'
% plot displacement
figure(1)
clf
subplot(2,1,1)
plot(t,Y(:,1))
grid on
xlabel('Time,s')
ylabel('Position, m')
subplot(2,1,2)
plot(t,Y(:,2))
grid on
xlabel('Time,s')
ylabel('Velocity, m/s')
%
% function that calculates derivatives of the states
%
function [dz]=sdoffile(t,z,F0,w,m,c,k)
dz=[0 1; -k/m -c/m]*z+[0;1/m]*F0*cos(w*t);
figure(1)
%clf
subplot(2,1,1)
hold on
plot(T,Yode(:,1),'r--')
grid on
xlabel('Time,s')
ylabel('Position, m')
hold of
subplot(2,1,2)
hold on
plot(T,Yode(:,2),'r--')
grid on
xlabel('Time,s')
ylabel('Velocity, m/s')
hold of
MEEG