필터 지우기
필터 지우기

setting ode45 to solve at even timesteps

조회 수: 3 (최근 30일)
Windell
Windell 2013년 4월 29일
Hi I'm attempting to force ode45 to solve a set of odes at at least some constant timestep. I understand that ode45 is a variable step solver so it is okay if it solves at intermediate timesteps. However, I would like to have it solve at at least some regular timestep also. For example, of the timestep is 1 second then I would like the solution to at least contain solutions at seconds 0,1,2,3,4,5 ...
Do any of you know how to make this happen?
thanks, windell
  댓글 수: 3
Jan
Jan 2013년 4월 29일
This is really surprising for tspan=0:10000 (btw, neither :1: not the addition square brackets are required): Actually the output times are expecte to be [0, 1, 2, ...]. So where does 0.9960 come from?
Please do not describe what you have intented by the code, but the code itself. Otherwise we cannot find bugs.
Walter Roberson
Walter Roberson 2013년 4월 29일
Wouldn't it make sense to interp1() to exact timepoints if your data is sufficiently close ?

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2013년 4월 29일
It is explained in the documentation how to force the intergrator to output the trajectory at certain time points: Use a vector with more than 2 elements for tspan.

추가 답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2013년 4월 29일
If you give it an array with the times for which you want the solution instead of just the start and stop time in the TSPAN input variable. Read first paragraph of ode45 help.
HTH,

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by