필터 지우기
필터 지우기

How do I incrementize ode solver outputs after solution?

조회 수: 1 (최근 30일)
Z Yerby
Z Yerby 2019년 6월 24일
편집: Z Yerby 2019년 6월 24일
I'm trying to take ode45 output and adjust it so the independent variable (time in this instance) has consistent increments e.g. make the step sizes 1 second instead of being all over the place as they are. What I have so far is that I know there an intersection calculator so I was thinking I could use a loop to place a line at each second mark and figure the intersection from that. Doing so is a really round about and messy way; I don't like it. I want to perform this incrementization post-solve so that I don't damage my solution. Is there an effecient way of doing this?

채택된 답변

Steven Lord
Steven Lord 2019년 6월 24일
You could specify the tspan input to the ODE solver as 0:yourEndingTime. If you do this the solver will return the value of the solution at the specified times. [Internally it will use whatever timesteps it needs to solve the problem to the appropriate precision, but it will then return the value of the solution at those time steps.]
If you do need to solve this after solving with a tspan input that consists of just the starting and ending time, pass the solution structure returned by the ODE solver into deval.
  댓글 수: 1
Z Yerby
Z Yerby 2019년 6월 24일
편집: Z Yerby 2019년 6월 24일
So for example, if I wanted to produce a solution at every second of a minute I would have tspan = 0:1:60?
I didn't know about the deval function though. That certainly will come in handy.

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

추가 답변 (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