Problem converting "suspn" model from Simulink to script - Results not matching

2 ビュー (過去 30 日間)
Matt
Matt 2014 年 11 月 11 日
回答済み: Matt 2014 年 11 月 12 日
Hello,
I have tried to convert the existing MATLAB example available in Simulink called "sldemo_suspn", without success. I managed to have a running script, but the results given are different from those I get from Simulink.
For simplicity, in both the Simulink model and my script, I have removed the inputs so the system is only working to reach equilibrium. Here is my script:
Lf = 0.9;
Lr = 1.2;
Mb = 1200;
Iyy = 2100;
Kf = 28000;
Kr = 21000;
Cf = 2500;
Cr = 2000;
g=9.81;
timestep=0.01;
Mfront=0;
Mrear=0;
My=0;
Ffront=0;
Frear=0;
tetadot=0;
teta=0;
zdot=0;
z=0;
for(t=0:timestep:10)
tetadotdot=(My+Mfront+Mrear)/Iyy;
tetadot=tetadot+(tetadotdot*timestep);
teta=teta+(tetadot*timestep);
zdotdot=(Ffront+Frear-(Mb*g))/Mb;
zdot=zdot+(zdotdot*timestep);
z=z+(zdot*timestep);
Ffront=(2*Kf*(Lf*teta-z))+(2*Cf*(Lf*tetadot-zdot));
Frear=-(2*Kr*(Lr*teta+z))-(2*Cr*(Lr*tetadot-zdot));
Mfront=-Lf*Ffront;
Mrear=Lr*Frear;
t=t+timestep;
end
Here is the front force graph that I get from Simulink:
And the same but from my script file:
I am confused. Why are they not the same?

回答 (1 件)

Matt
Matt 2014 年 11 月 12 日
Bump, anyone spotting the problem?

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by