cleart=0:0.1:10; %time peroid
Y0= input('wave amplitude ') ; %Wave amplitude
l= input('length of wave ') ; %length of the wave
u=10; %Boat Velocity
w=u/l; %frequency of wave
y=Y0*sin(w*t); %wave height model
Dr= input('damping ratio '); %Required Damping Ratio
if (Dr<0 || Dr>=1) % test for acceptable damping ratio.
error('Damping ratio not in acceptable range!')endk=17000; %Spring Constant of suspension
m=100;wn=(k/m)^0.5;wd=wn*(1-Dr^2)^0.5;if (wd<6) error('Suspension excessively soft') %test for suspension softness
endr=w/wn; %Frequency ratio
b=2*Dr*(k*m)^(0.5); %Damping coefficient
i=(1-r^2)^2+(2*Dr*r)^2; X0=(r^2)*Y0/(i^0.5); %Maximum amplitude of displacement
T=atan((2*Dr*r)/(1-r^2)); %Spatial Frequency
x=X0*sin(w*t-T); %Displacement of sprung mass
A = [0 1; -k/m -b/m]; %state space matrices
B = [0 1/m]';C = [x 0]; %I have put y into the input matrix as that is the wave input
D = [0];sys=ss(A,B,C,D);plot(t,x)
MATLAB: I need to find the displacement and velocity characteristics of a suspended mass on a boat. I am struggling to develop a state space expression that can take a sinusoidal input, and then to plot graphs of displacement and velocity from this.
state-spacesuspension
Best Answer