Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Matt
Matt el 11 de Nov. de 2014
Respondida: Matt el 12 de Nov. de 2014
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?

Respuestas (1)

Matt
Matt el 12 de Nov. de 2014
Bump, anyone spotting the problem?

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by