1 year ago
#379147
Peter Lindhøj Tuxen
equation manipulation in MATLAB
I have a problem using MATLAB for a dynamics problem. The problem is how to code in MATLAB, not how to solve the equation. I'm fairly new to MATLAB.
I have 2 equations of motion like
DDx_c =
((kx_c - (m_p(2Dtheta^2lsin(theta) - (2lcos(theta)((m_psin(2theta)Dtheta^2l^2)/2 + (m_psin(2theta)l^2)/2 - gm_psin(theta)l + F - b_cx_c))/(I + l^2m_pcos(theta)^2)))/2)(I + l^2m_pcos(theta)^2))/(l^2m_p^2cos(theta)^2)
and
DDtheta =
-((m_c + m_p)(F - b_cx_c + (l^2m_psin(2theta))/2 + (Dtheta^2l^2m_psin(2theta))/2 - glm_psin(theta) + (lm_pcos(theta)(- lm_psin(theta)Dtheta^2 + kx_c))/(m_c + m_p)))/(l^2m_p^2*cos(theta)^2)
My problem is that i would like to have these equations on State Space form, in order to generate a transfer function. My problem is, that i'm not able to separate the expressions in the equation. It could be done by hand ofcause, but i would realy like this program to be generic
Could a solution be to convert the equation to a string(char array), and copy the expressions separated by '+' and '-' to some new variables, like it could be done in C++. I'm just not sure how to do it.
matlab
differential-equations
state-space
0 Answers
Your Answer