Implement ode15s function in a discrete model

How to implement the ode15s function in a discretized model?
In the continuous model it was quieter, as I found several examples. Now in the discretized model I can not find anything to help me. I emphasize that I am learning to program, so all help and the way that is explained to a lay person will be appreciated.
I can implement and compile by placing the template and specifying the step size. But I would like to apply this numerical solution to the model, just as it was done in the continuum. Any idea how to comoralize this process?
It follows two codes of the discretized model, both get the same results, except that the code_discret_1 is in state space format and the other is in systems format.

 Accepted Answer

ode15s() and all the other ode* functions that have two numbers after 'ode' (e.g. ode45), are all variable timestep solvers, and all require continuous states. Some of them such as ode45 will, if necessary, go backwards and forwards in time in order to get the required precision.
For discrete states, you need to use a fixed step solver.
MATLAB does not officially provide fixed step solvers for calling from MATLAB, but they have provided a series of them available through https://www.mathworks.com/matlabcentral/answers/98293-is-there-a-fixed-step-ordinary-differential-equation-ode-solver-in-matlab-8-0-r2012b#answer_107643

5 Comments

Hello Walter, thank you so much for the answer!
A question, I entered the link sent by you and I had a doubt, when the same speaks
These are included in the attached zip file. After saving the files into a folder located on the MATLAB path, these solvers can be used with the following syntax:
y = ode4 (odefun, tspan, y0);
Should this attached folder be saved in the matlab folder or inside some subfolder of the matlab folder?
I recommend saving them to one of your own folders that you create for this purpose, not anywhere under the location where MATLAB was installed. You can use pathtool to add the folder to the MATLAB path.
Thank you ... I do not know if it would be appropriate to ask another question regarding the problem in this topic, but if not, I'll open another topic. And if in case my discretized model is a rigid Walter system, how to proceed? The methods previously reported on the link that you have mostly subscribed to are explicit methods that are best suited for non-rigid systems. And for rigid discrete models, what methods do you recommend?
I have never heard of a Walter system; is that related to http://www.pnas.org/content/pnas/25/9/468.full.pdf ?
Anyhow, I recommend opening a new topic, as I do not have experience with rigid systems.

Sign in to comment.

More Answers (0)

Asked:

GTA
on 19 Jul 2018

Commented:

GTA
on 19 Jul 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!