problem with reduceDifferentialOrder -> massMatrixForm -> odeFunction
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
参考
カテゴリ
Help Center および File Exchange で Special Values についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!