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 commentaires

Star Strider
Star Strider le 17 Déc 2020
Modifié(e) : Star Strider le 17 Déc 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 ?

Connectez-vous pour commenter.

 Réponse acceptée

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 commentaire

KK
KK le 18 Déc 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by