Why is the resulting time-domain curve from Euler method and ode45 not stable?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ni Made Ayu Sinta Dewi
am 12 Jan. 2021
Beantwortet: Mischa Kim
am 13 Jan. 2021
I am writing a program to obtain the solution of an undamped free vibration system. At first, I used the Euler method and the resulting time-domain curve seemed normal (perfectly sinusoidal with the initial displacement as the amplitude). But when I checked the peaks using findpeaks, its value increased continuously (0.1, 0.1001, 0.1002, and so on). Then, I used the ode45 to do the same. The peaks of the time-domain curve decreased continuously from the initial displacement (0.1, 0.0999, 0.0998, and so on). Why is this happening? Am I doing something wrong?
2 Kommentare
Akzeptierte Antwort
Mischa Kim
am 13 Jan. 2021
Hi Ni Made Ayu Sinta Dewi, there is nothing you are doing wrong. What you are seeing is expected behavior. This is because you are using a numerical solver (e.g. ode45) to solve the differential equation. Numerical solutions are not exact solutions, they are only approximations. However, you have some control regarding the accuracy of the solution. E.g. you can set tolerance levels:
options = odeset('RelTol',1e-13); % the smaller the tolerance, the more accurate the result
[t,x] = ode45(@state_space,tspan,x0,options);
0 Kommentare
Weitere Antworten (0)
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!