solving a differential equation coupling together in matrix and vector form with ode45
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
roya afshar
am 6 Dez. 2018
Kommentiert: roya afshar
am 8 Dez. 2018
I have two problem:
1) I used two functions for solving a set of equation not in matrix or vector form but like
[x(2);3+x(4)+x(3);x(4);....................]
then [t,x] = ode45(@(t,x) lili(t,x),tspan,x0);
now I need the vector of dx=[x(2) x(4) x(6)]
but it doesnt return this vector.
2) i want to solve equation like this D2y=d2x+cross(m,n)
its clear cross product is in vector form
how could i solve matrix form of differential equation?
especially initial values is a vector
1 Kommentar
Torsten
am 6 Dez. 2018
1) Unclear what you have done and what your problem is. Please provide the code you are using and possibly the error message you get.
2) ODE45 expects the differential equations to be given in vector format. So convert your equations from matrix form to vector form.
Best wishes
Torsten.
Akzeptierte Antwort
roya afshar
am 7 Dez. 2018
2 Kommentare
Torsten
am 7 Dez. 2018
You solve
x1'' = x1
x2'' = x2 + 1
x3'' = x3 + 2
with initial conditions
x1(0)=1, x2(0)=8, x3(0)=9, x1'(0)=2, x2'(0)=3, x3'(0)=4
and plot x1, x2 and x3 in plot 1 and x1', x2' and x3' in plot 2.
Is it that what you wanted to achieve ?
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!