ode45 for Higher Order Differential Equations
Show older comments
I'm learning Matlab and as an exercise I have following:
on the time interval [0 20]and with integration step < 0.01. Initial conditions are x(0) = 0.44;
= 0.13;
= 0.42;
= -1.29
To solve it I wrote the code:
f = @(t, y) [y(4); y(3); y(2); 1 - y(1)^2 - 6*y(3)];
t = [0 100];
f0 = [-0.44; 0.13; 0.42; -1.29];
[x, y] = ode45(f, t, f0);
plot(x,y, '-');
grid on
However I'm not really sure that it's correct even it launches and gives some output. Could someone please have a look and correct it if it's wrong. Also where is integration step here?
1 Comment
Star Strider
on 18 Jun 2022
Edited: Star Strider
on 18 Jun 2022
The integration is performed within the ode45 function. To understand how it works to do the integration, see Algorithms and the Wikipedia article on Runge-Kutta methods.
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
