How to display constants in equation solving

The solution of simultaneous linear equations does not include the characters declared as constants.
Please tell me how to display the constants of the solution as they are.
(I'm using the symbolic math toolbox)

2 Kommentare

Star Strider
Star Strider am 17 Dez. 2020
Bearbeitet: Star Strider am 17 Dez. 2020
KK posted as an Answer —
I'm not used to using Matlab.
Please scrutinize the file
Are you saying that when you look at the solution for THETADDOT that you want to see names such as m_p in it ?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Dez. 2020

0 Stimmen

L =
(I_h*(diff(phi(t), t)^2 + diff(theta(t), t)^2))/2 + (m_b*((r*(diff(phi(t), t) + diff(theta(t), t)) + h*cos(phi(t))*diff(phi(t), t))^2 + h^2*sin(phi(t))^2*diff(phi(t), t)^2))/2 + (m_p*((r*(diff(phi(t), t) + diff(theta(t), t)) + H*cos(phi(t))*diff(phi(t), t) + l*cos(psi(t))*psi(1, t))^2 + (H*sin(phi(t))*diff(phi(t), t) + l*sin(psi(t))*psi(1, t))^2))/2 + (I_b*diff(phi(t), t)^2)/2 + (I_p*psi(1, t)^2)/2 + (m_h*r^2*(diff(phi(t), t)^2 + diff(theta(t), t)^2)^2)/2 - g*m_p*(h*cos(phi(t)) + l*cos(psi(t))) - g*h*m_b*cos(phi(t))
subs(L, theta, dum_)
ans =
(m_b*((r*diff(phi(t), t) + h*cos(phi(t))*diff(phi(t), t))^2 + h^2*sin(phi(t))^2*diff(phi(t), t)^2))/2 + (m_p*((H*sin(phi(t))*diff(phi(t), t) + l*sin(psi(t))*psi(1, t))^2 + (r*diff(phi(t), t) + H*cos(phi(t))*diff(phi(t), t) + l*cos(psi(t))*psi(1, t))^2))/2 + (I_b*diff(phi(t), t)^2)/2 + (I_h*diff(phi(t), t)^2)/2 + (I_p*psi(1, t)^2)/2 - g*m_p*(h*cos(phi(t)) + l*cos(psi(t))) + (m_h*r^2*diff(phi(t), t)^4)/2 - g*h*m_b*cos(phi(t))
Notice that theta disappeared when you did the subs(). The expression includes diff(theta(t),t) . When you subs(expression, theta, dum_) then that becomes diff(dum_,t) and since dum_ is not a function of t, that becomes 0 .
Which release are you using? Taking a derivative with respect to a simple function had support added in R2020b.

1 Kommentar

KK
KK am 18 Dez. 2020
Thank you for your answer, Mr. Walter Roberson.
I am using R2020b.
Once I replaced theta with dum_, differentiated it, and changed dum_ back to theta.
Let's check again for any mistakes.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Gefragt:

KK
am 17 Dez. 2020

Kommentiert:

KK
am 18 Dez. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by