ode45 is returning the incorrect solution
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Koren Murphy
am 17 Mär. 2020
Kommentiert: Ameer Hamza
am 17 Mär. 2020
I am running an ode45 to solve a simple intergration. The intergration is so simple I can perform it by hand - hence knowing the solution returned is excessively large.
function [Output] = ContinuousFeed(t,u)
uA = u(1);
uB = u(2);
uE = u(3);
uF = u(4);
u = [uA; uB; uE; uF];
Output = u;
end
t=[0 10];
u0 = [1; 0.0002; 0; 0];
[t, u] = ode45 (@ContinuousFeed, t ,u0);
Why is it returning a final value of 22030.53 for the first column? All other columns are displaying inaccurate answers also.
Thank you!
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 17 Mär. 2020
Bearbeitet: Ameer Hamza
am 17 Mär. 2020
The MATLAB is giving the correct solution. You are solving four independent ODEs of the form
which have an anatylical solution
The solution of ode45 matches this analytical solution.
7 Kommentare
Ameer Hamza
am 17 Mär. 2020
If my initial feed you meant initial conditions, then this is the expected behavior. Vector u0 tells the ode45 where to start the solution of each variable.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!