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.

1 回表示 (過去 30 日間)
clear
t=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!')
end
k=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
end
r=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)

採用された回答

Birdman
Birdman 2020 年 4 月 2 日
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
C=[1 0;0 1];
Also, to simulate the system under a sine input, you need to use lsim command:
lsim(sys,x,t);
The overall code:
clear
t=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!')
end
k=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
end
r=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 = [1 0;0 1]; %I have put y into the input matrix as that is the wave input
D = [0];
sys=ss(A,B,C,D);
lsim(sys,x,t)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by