Why bad partial differentiation?
Ältere Kommentare anzeigen
Hi, I've a problem with this:
input parameter to my function is degree-it's number
There is a reason why I need m0,phi0 and not l0
m=sym('m',[1,degree]);
m=[m0 m];
l=sym('l',[degree,1]);
phi=sym('phi',[1,degree]);
phi=[phi0 phi] ;
for i=1:length(phi)
phi(i)=strcat(char(phi(i)),'(t)');
end
B=(1/2)*l(1)*m(2)*diff(phi(1),t)*diff(phi(2),t)*cos(phi(2))
phit=phi(2)
subs(diff(subs(B, phit, 'phit'),'phit'),'phit', phit)
I want to derive according to phi1(t), and the result is 0, but I expect (-1/2)*l1*m1*diff(phi0(t),t)*diff(phi1(t),t)*sin(phi1(t))
BUT, when I derive this B=(1/2)*l(1)*m(2)*diff(phi(1),t)*cos(phi(2)), it's all righ,
Any help would be appreciated
4 Kommentare
Walter Roberson
am 9 Mär. 2013
Note: subs(expression, newvalue, name) is an obsolete syntax that is still supported for backwards compatibility. It should be subs(expression, name, newvalue) as in
subs(S, 'phit', phit)
dodovoscek
am 9 Mär. 2013
Bearbeitet: dodovoscek
am 9 Mär. 2013
Walter Roberson
am 9 Mär. 2013
Could I ask you to show the value of B before the differentiation ?
dodovoscek
am 9 Mär. 2013
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Numeric Solvers finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!