How to implement tightly coupled nonlinear odes using ode45 in matlab?
Ältere Kommentare anzeigen
I am solving a problem from fluid dynamics; in particular tightly coupled nonlinear ordinary differential equations. The following is a scaled-down version of my actual problem. I have solved system of coupled odes many times in the past but this case is different since double derivatives of one variable depends on the double derivative of another variable. How do I implement it in ode45? I need 3 x 2 = 6 plots of x, x-dot and x-ddot versus time for t, 0 to 2. All required initial conditions have zero values at t = 0 How do I store the updated value of the double derivatives as the ode45 code runs? The way ode45 works, I get x and x-dot as output but not the double derivatives. Any help will be highly appreciated.

8 Kommentare
John D'Errico
am 12 Nov. 2018
Did you read the documentation for ODE45? In there as I recall, it shows you how to convert higher order differentials into a system of first order problems.
Vikash Pandey
am 12 Nov. 2018
madhan ravi
am 12 Nov. 2018
what are the intial conditions??
Vikash Pandey
am 12 Nov. 2018
Bearbeitet: Vikash Pandey
am 12 Nov. 2018
madhan ravi
am 12 Nov. 2018
Bearbeitet: madhan ravi
am 12 Nov. 2018
I have always used FORTRAN to solve such equations,
so does the result coincide with fortran?
Vikash Pandey
am 12 Nov. 2018
Bearbeitet: Vikash Pandey
am 12 Nov. 2018
Torsten
am 12 Nov. 2018
ydot(3)=y(3) and ydot(6)=y(6) ? Looks wrong to me.
Vikash Pandey
am 12 Nov. 2018
Bearbeitet: Vikash Pandey
am 12 Nov. 2018
Akzeptierte Antwort
Weitere Antworten (1)
Vikash Pandey
am 12 Nov. 2018
0 Stimmen
12 Kommentare
Vikash Pandey
am 12 Nov. 2018
If your equations are like in the modified problem, set
y1=x1
y2=x1'
y3=x1''
y4=x2
y5=x2'
y6=x2''
and solve the DAE system
y1'=y2
y2'=y3
y4'=y5
y5'=y6
y3+t*y6^2-t*y4+y1*y5=0
t*y3+y6-t^2*y1-y4*y2=0
As for the former case, initial conditions are only necessary for x1, x1', x2 and x2'.
Vikash Pandey
am 12 Nov. 2018
I don't understand how you want to formulate the problem for ODE45 in this case.
Usually, you can explicitly solve for x1'' and x2'' as expressions of x1,x1',x2,x2' and t (two equations in the two unknowns x1'' and x2''). This is in principle possible for your modified problem (with ugly right-hand side F) , but not for your original problem (why ?).
If it's possible, you can write your system as a first-order system consisting of 4 equations.
If it's not possible, you can write your system as a system of 4 ODEs and 2 AEs as I did for the modified problem.
Vikash Pandey
am 12 Nov. 2018
Bearbeitet: Vikash Pandey
am 12 Nov. 2018
Vikash Pandey
am 12 Nov. 2018
Torsten
am 12 Nov. 2018
I see no difference to the modified problem from above. So you can solve it the way I suggested.
Vikash Pandey
am 13 Nov. 2018
Huy Nguyen
am 6 Dez. 2022
hi, I have the same problem. can you help me or share the code please?
Sam Chak
am 6 Dez. 2022
Hi @Huy Nguyen
Would advise you to post your specific problem in a New Question. Also to clarify whether it's a math-related problem or a technical problem in MATLAB code.
Huy Nguyen
am 7 Dez. 2022
hi, thanks for your reply. I fix the problem.
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




