Problem with factoring a symbolic variable
2 views (last 30 days)
Show older comments
Hi. I have the following relatively simple symbolic equation, and I would like to calculate the terms that multiply Td_s. In this case, the result should be sin(T_s - T_u)*Td_s. However, I can't get this to work using "factor".
syms T_u T_t T_s tau_u Tdd_u Tdd_t Tdd_s Td_u Td_t Td_s;
eq = sin(T_s - T_u)*Td_s^2 + sin(T_t - T_u)*Td_t^2 - tau_u + (981*sin(T_u))/100 - Tdd_s*cos(T_s - T_u) - Tdd_t*cos(T_t - T_u);
factor(eq,Td_s)
Answers (1)
Paul
on 14 Nov 2022
If only one term contains Td_s, then
syms T_u T_t T_s tau_u Tdd_u Tdd_t Tdd_s Td_u Td_t Td_s;
eq = sin(T_s - T_u)*Td_s^2 + sin(T_t - T_u)*Td_t^2 - tau_u + (981*sin(T_u))/100 - Tdd_s*cos(T_s - T_u) - Tdd_t*cos(T_t - T_u)
c = children(eq);
c = c(has([c{:}],'Td_s'));
result = c/Td_s
Additional effort will be required if Td_s can show up as a coefficient in more than one term or if it can appear as part of a function argument.
0 Comments
See Also
Categories
Find more on Equation Solving 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!