problem with reduceDifferentialOrder -> massMatrixForm -> odeFunction
20 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello.
I am trying to get the Euler-Lagrange equation for a mechanical system and to integrate them numerically. The code is pasted below.
What I get is an error message from 'odeFunction'
Error using mupadengine/feval (line 163) The parameter 'diff(phi(t), t)' is invalid.
Error in sym/odeFunction (line 118) A = feval(symengine, 'daetools::odeFunction', expr, vars, params{:});
I do not understand this error as, at least explicitly, the derivatives diff(phi(t),t), etc are not present neither in M nor in F.
Thank you. Best regards.
syms R L0 m g real
for s = [R L0 m g]
assume(s>0);
end
syms phi(t)
%phi(t) = (L0-s(t))/R;
urho = [ cos(phi), sin(phi)];
uphi = [-sin(phi), cos(phi)];
ux = sym([1 0]);
uy = sym([0 1]);
syms l2(t)
%
r1 = R*urho + (L0-l2-phi*R)*uphi;
r2 = R*ux - l2*uy;
v1 = diff(r1,t);
v2 = diff(r2,t);
T = sym(1/2)*m*( simplify(v1*v1.'+v2*v2.'));
V = (m*g*r1+m*g*r2)*(uy.');
L = T-V;
eqnizq = simplify(functionalDerivative(L,[phi l2]) );
eqn = eqnizq == 0;
[newEqs, newVars, R] = reduceDifferentialOrder(eqn, [phi(t) l2(t)]);
[M,F] = massMatrixForm(newEqs,newVars);
Mn = odeFunction(M, newVars, m,g,R,L0)
Fn = odeFunction(F, newVars, m,g,R,L0)
0 commentaires
Réponses (2)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!