필터 지우기
필터 지우기

Turn variable-step solution into fixed-step

조회 수: 2 (최근 30일)
Viggo Wivestad
Viggo Wivestad 2016년 9월 22일
답변: Star Strider 2016년 9월 22일
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?

채택된 답변

Star Strider
Star Strider 2016년 9월 22일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by