Borrar filtros
Borrar filtros

Turn variable-step solution into fixed-step

2 visualizaciones (últimos 30 días)
Viggo Wivestad
Viggo Wivestad el 22 de Sept. de 2016
Respondida: Star Strider el 22 de Sept. de 2016
I am simulating a system that is very stiff and nonlinear using ODE23s. I need the variable step-length for the simulation to be stable. After the simulation I m going to analyse the dynamics of the system in a different program, and I need all my simulations to have the same length. Anyone has any experience making the simulation output uniformly sampled? Is this some setting in the ODE-solver or could I possibly use interp1?

Respuesta aceptada

Star Strider
Star Strider el 22 de Sept. de 2016
The ODE solvers are adaptive, but if you want all the results to have the same row length, you can specify the ‘tspan’ argument to have a specific length. The ODE solvers will output the closest results to the desired ‘tspan’ values that it estimates. You will not need to interpolate the results:
t0 = ...; % Start Time
tf = ...; % End Time
N = ...; % Number Of Time Values (Row Length Of Results)
tspan = linspace(t0, tf, N);
ic = [...]; % Initial Conditions Vector
[t,y] = ode45(@odefun, tspan, ic);
You can use the same construction to integrate all your ODE functions.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by