Solving a system of differential equation
1 view (last 30 days)
Show older comments
Can someone tell me why the answers are coming as 'NaN'?
Also in the first for loop, by writing dEs in descritized form (line 22 and 23) my aim is to find (dEs/dt) and use the value of Es in line 23. Also,after this loop, the final values of El and Es needs to be carried over to next loop. I have coded this as best as i know. Can someone tell me how i can find d(Es)/dt directly instead of discretizing it?
7 Comments
Ameer Hamza
on 20 Oct 2020
But a scheme like this will not work as expected. ode45() does not do one calculation in each iteration. It is an adaptive step-size algorithm, and the point moves forward and backward several times in each iteration for ode45 to decide what should be a good step length. So You might be expecting that it is the value from the previous iteration, but is not exactly that.
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!