You need to define your outputs(with C matrix) correctly. Since you would like to see both displacement and velocity, then C matrix has to be
Also, to simulate the system under a sine input, you need to use lsim command:
The overall code:
clear
t=0:0.1:10;
Y0= input('wave amplitude ') ;
l= input('length of wave ') ;
u=10;
w=u/l;
y=Y0*sin(w*t);
Dr= input('damping ratio ');
if (Dr<0 || Dr>=1)
error('Damping ratio not in acceptable range!')
end
k=17000;
m=100;
wn=(k/m)^0.5;
wd=wn*(1-Dr^2)^0.5;
if (wd<6)
error('Suspension excessively soft')
end
r=w/wn;
b=2*Dr*(k*m)^(0.5);
i=(1-r^2)^2+(2*Dr*r)^2;
X0=(r^2)*Y0/(i^0.5);
T=atan((2*Dr*r)/(1-r^2));
x=X0*sin(w*t-T);
A = [0 1; -k/m -b/m];
B = [0 1/m]';
C = [1 0;0 1];
D = [0];
sys=ss(A,B,C,D);
lsim(sys,x,t)
Best Answer