Why do the results from ODE45 and Simulink differ when applied on the same ordinary differential equation in MATLAB 7.9 (R2009b)?
11 views (last 30 days)
Show older comments
When I solve the ordinary differential equation using Simulink and ODE45 function in MATLAB, they return different results. I use the fixed step ode4 (Runge Kutta) solver in Simulink to solve the ode.
Run the attached files lumped_parameter_P6_4.m and lumper_parameter.mdl and compare the output from both the methods. The maximum and the minimum output values are supposed to be 45 and 65 in both the cases. Simulink gives the correct output while ODE45 returns minimum and maximum values between 45 and 65.
Accepted Answer
MathWorks Support Team
on 15 Jan 2010
The ODE45 is a variable step solver. Simulink solves the problem as a fixed step solver. The ODE45 can replicate the results of Simulink if a limit is imposed on the maximum step that it can take using the odeset function.
>> options = odeset('MaxStep',1);
0 Comments
More Answers (0)
See Also
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!