Parse error help please

1 次查看(过去 30 天)
Patrick Bradford
Patrick Bradford 2019-7-25
parse error line 8. It's supposed to be the "normal force' (z) on the front left tire, x first derivative of wx. But it freaks out about the equil sign. Suggestions?
%%Equilibrium, roll
%% Inertial term for roll rotation is Jsx * first derivitive of wx.
%% Fflz is Normal Force, Front left z axis
%% sprung body roll inertia is (Js,x)
%% which differs from Whole Vehicle roll inertia, (Jx).
%% Damping forces Paralell to each spring force. Summation of Fdfl, Fdfr,Fdrl and Fdrr.
Jsx*der(wx) = (Fflz + Frlz)*w/2 - (Ffrz + Frrz)*w/2 + (Ffyv + Fry)*h;
%%Equilibrium for each axle (pitch, around roll centre):
(Fflz - (Fsfl + Fdfl))*w/2 - (Ffrz - (Fsfr + Fdfr))*w/2 + Ffy*hRCf = 0;
(Frlz - (Fsrl + Fdrl))*w/2 - (Frrz - (Fsrr + Fdrr))*w/2 + Fry*hRCr = 0;
%%Constitutive relation for tyres (Lateral tyre force model):
Ffyw = -sign(sfy)*(min((Cf/2)*abs(sfy), mu*Fflz) + min((Cf/2)*abs(sfy), mu*Ffrz));
Fry = -sign(sry)*(min((Cr/2)*abs(sry), mu*Frlz) + min((Cr/2)*abs(sry), mu*Frrz));
sfy = vfyw/vfxw;
sry = vry/vrx;
%%Constitution for springs:
der(Fsfl) = -cfw*vflz;
der(Fsfr) = -cfw*vfrz;
der(Fsrl) = -crw*vrlz;
der(Fsrr) = -crw*vrrz;
%%Constitution for dampers:
Fdfl = -dfw*vflz;
Fdfr = -dfw*vfrz;
Fdrl = -drw*vrlz;
Fdrr = -drw*vrrz;
%%Compatibility, out of road plane:
vflz = +w/2*wx;
vfrz = -w/2*wx;
vrlz = +w/2*wx;
vrrz = -w/2*wx;
  2 个评论
Joel Handy
Joel Handy 2019-7-25
Are you using the symbolic math toolbox? I don't have any experience with that toolbox, so maybe this is valid syntax there, but if not, Jsx*der(wx) is not a valid variable name.
Rik
Rik 2019-7-25
Also with that toolbox the name is invalid.

请先登录,再进行评论。

回答(2 个)

Jan
Jan 2019-7-25
编辑:Jan 2019-7-25
I guess, this line is failing:
Jsx*der(wx) = (Fflz + Frlz)*w/2 - (Ffrz + Frrz)*w/2 + (Ffyv + Fry)*h;
Yes, of course. In Matlab the = is the operator for assigning a value to a variable. The shown line is a methematical formula, but not a valid Matlab instruction. You need a variable on the left hand side of the =.
This will not work also:
(Fflz - (Fsfl + Fdfl))*w/2 - (Ffrz - (Fsfr + Fdfr))*w/2 + Ffy*hRCf = 0;
What is the meaning of tis line:
der(Fsfl) = -cfw*vflz;
?
It is not clear, what you try to achieve. The posted text is no Matlab code.
  1 个评论
Patrick Bradford
Patrick Bradford 2019-7-25
It's my attempt at reacreating vehicle dynamics inputs for code. I think I might have to use matrix to make this work. I am a matlab noob, the code is mostly just trial and error attempts at trying to directly input math into matlab. lol

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2019-7-26
编辑:Walter Roberson 2019-7-26
eqn1 = Jsx*diff(wx, Something) == (Fflz + Frlz)*w/2 - (Ffrz + Frrz)*w/2 + (Ffyv + Fry)*h;
Where Something is the variable the derivative is to be taken with respect to.
You should look at the examples for dsolve()
I would, however, advise that often vehicle dynamics is required to be about numeric solutions rather than about closed form solutions: the equations are often too complex for closed form solutions. The symbolic toolbox can be useful in writing down the equations, to be followed by using tools such as ode2vectorfield() and odeFunction to generate functions to pass in to numeric solvers such as ode45().

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by