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

Star Strider
Star Strider 2020년 12월 17일
편집: Star Strider 2020년 12월 17일
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 ?

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 17일

0 개 추천

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

KK
KK 2020년 12월 18일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

KK
2020년 12월 17일

댓글:

KK
2020년 12월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by