Error using inlineeval (line 14)
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dexter
am 8 Apr. 2021
Beantwortet: Steven Lord
am 8 Apr. 2021
I am trying to differentiate a symbolic function and I get Error using inlineeval (line 14) and then error inline/subref (line 23) INLINE OUT=..
This is my code
syms m1 m2 m3 l1 l2 l3 lc1 lc2 lc3 Ic1 Ic2 Ic3 th1 th2 th3 th1_dot th2_dot th3_dot g
L=inline('(1/2*m1*lc1^2 + 1/2*Ic1*th1_dot^2 + 1/2*m2*(l1^2 + lc2^2 * (th1_dot+th2_dot)^2 +2*l1*lc2*(th1_dot+th1_dot*th2_dot)*cos(th2)) + 1/2*Ic2(th1_dot+th2_dot)^2 + 1/2*m3*(2*l1*l2*cos(th2)*th1_dot*(th1_dot+th2_dot)+ l1^2 * th1^2 +2*l1*lc3*cos(th2+th3)*th1_dot(th1_dot+th2_dot+th3_dot)+ l2^2 *(th1_dot+th2_dot)^2 +2*l2*lc3 *cos(th3)*(th1_dot+th2_dot)*(th1_dot+th2_dot+th3_dot)+lc3^2 *(th1_dot+th2_dot+th3_dot)^2) + 1/2 * Ic3*(th1_dot+th2_dot+th3_dot)-m1*g*lc1*sin(th1)-m2*g*(l1*sin(th1)+lc2*sin(th1+th2)) - m3*g*(l1*sin(th1)+l2*sin(th1+th2)+lc3*sin(th1+th2+th3))','m1','m2', 'm3', 'l1', 'l2', 'l3', 'lc1', 'lc2', 'lc3', 'Ic1', 'Ic2', 'Ic3', 'th1', 'th2', 'th3', 'th1_dot', 'th2_dot', 'th3_dot', 'g')
part_1=diff(L(m1,m2,m3,l1,l2,l3,lc1,lc2,lc3,Ic1,Ic2,Ic3,th1,th2,th3,th1_dot,th2_dot,th3_dot,g),th1)
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 8 Apr. 2021
Do not use inline. We first marked it "not recommended" somewhere between 15 and 20 years ago if I recall correctly.
Just operate on the symbolic variables, like:
syms x y
f = x.^2 + 2*y.^3
diff(f, x)
diff(f, y)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Robust Control Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
