How can I simplify complex symbolic equations? Simplify not working
Show older comments
I'm having issues simplifying a large symbollic expression that Matlab outpiuts. I've tried using the simplify() command, but it doesn't seem to make any differences. Here's an example of the expression that I want to simplify:
syms R_s R_w r_w r_cm I_s I_r m_r m_s g tau
syms theta_s theta_b dtheta_s dtheta_b ddtheta_s ddtheta_b
eqn = (R_s*(I_r*R_s*r_w*tau - I_r*R_s*R_w*tau - I_r*R_s^2*tau + dtheta_b^2*m_r^2*r_cm^3*r_w*sin(theta_b + theta_s)^3 + dtheta_s^2*m_r^2*r_cm^3*r_w*sin(theta_b + theta_s)^3 - R_w*m_r*r_cm*tau*cos(theta_b + theta_s) - R_s^2*m_r*r_cm^2*tau*cos(theta_b + theta_s)^2 + m_r*r_cm*r_w*tau*cos(theta_b + theta_s) - R_s^2*m_r*r_cm^2*tau*sin(theta_b + theta_s)^2 + g*m_r^2*r_cm^2*r_w*cos(theta_b + theta_s)*sin(theta_b + theta_s) + 2*dtheta_b*dtheta_s*m_r^2*r_cm^3*r_w*sin(theta_b + theta_s)^3 + I_r*dtheta_b^2*m_r*r_cm*r_w*sin(theta_b + theta_s) + I_r*dtheta_s^2*m_r*r_cm*r_w*sin(theta_b + theta_s) - R_s*R_w*m_r*r_cm^2*tau*cos(theta_b + theta_s)^2 - R_s*R_w*m_r*r_cm^2*tau*sin(theta_b + theta_s)^2 + R_s*m_r*r_cm^2*r_w*tau*cos(theta_b + theta_s)^2 + R_s*m_r*r_cm^2*r_w*tau*sin(theta_b + theta_s)^2 + dtheta_b^2*m_r^2*r_cm^3*r_w*cos(theta_b + theta_s)^2*sin(theta_b + theta_s) + dtheta_s^2*m_r^2*r_cm^3*r_w*cos(theta_b + theta_s)^2*sin(theta_b + theta_s) + 2*dtheta_b*dtheta_s*m_r^2*r_cm^3*r_w*cos(theta_b + theta_s)^2*sin(theta_b + theta_s) + 2*I_r*dtheta_b*dtheta_s*m_r*r_cm*r_w*sin(theta_b + theta_s)))/(r_w*(I_s*R_s^2*m_r*r_cm^2*cos(theta_b + theta_s)^2 + I_s*R_s^2*m_r*r_cm^2*sin(theta_b + theta_s)^2 + I_r*I_s*R_s^2 + m_r^2*r_cm^2*sin(theta_b + theta_s)^2 + m_s*m_r*r_cm^2*cos(theta_b + theta_s)^2 + m_s*m_r*r_cm^2*sin(theta_b + theta_s)^2 + I_r*m_r + I_r*m_s));
simplify(eqn)
Just looking at this expression, I can see that there are sin^2(x)+cos^2(x) = 1 simplications that could be made, as well as terms that could be collected. Is there any way to make MATLAB do this for me, as opposed to me trying to do this by hand (and likely making errors)?
Accepted Answer
More Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!