How Can the Output of odetovectorfield be Used

9 views (last 30 days)
Paul
Paul on 18 Nov 2021
Answered: Abhishek Kolla on 5 Jan 2022 at 6:17
Other than sending to matlabFunction(), how can one use the output of odetovectorfield?
syms x(t)
eqn = diff(x(t),t,2) + diff(x(t),t) + x == 0;
V = odeToVectorField(eqn);
V =
Y[2]
- Y[1] - Y[2]
What are these things with sqaure brackets and how can I do anything with V? For example, suppose I want express V as A*Y
[A,b] = equationsToMatrix(V==0)
A = 
b = 
What is that result? Is there a way to sub Y1 and Y2 for Y[1] and Y[2]?

Answers (1)

Abhishek Kolla
Abhishek Kolla on 5 Jan 2022 at 6:17
Hi Paul,
The elements of V represent the system of first order differential equations. You can refer to this link for more information on the relation between output and input.
The function equationstomatrix converts the equations in V to matrix form. A represent left side cooefficients and b represent right side constant part in the system of linear equations obtained from V. You can refer to this link for more examples.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!