Matrix form of system of equations with symbolic time dependant values
Show older comments
I have a system of equations with symbolic time dependant values:
t = sym('t');
q1(t)= sym('q1(t)');
q2(t) = sym('q2(t)');
x = diff(q1(t)*q2(t), t)
y = diff(q1(t)+q2(t)^2,t)
with the following output:
x =
q1(t)*diff(q2(t), t) + q2(t)*diff(q1(t), t)
y =
2*q2(t)*diff(q2(t), t) + diff(q1(t), t)
Is it possible to obtain the matrix form of these equations without doing it manually? something similar to this:
[q2(t), q1(t); 1, 2*q2(t)]*[diff(q1(t), t); diff(q2(t), t)]
Unfortunately, equationsToMatrix() doesn't seem to work in this case.
This example is relatively easy, but the equations I am working on are more complex and I would need some sort of automation. Any advise on working with symbolic math will be really appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers 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!