필터 지우기
필터 지우기

ode45 and sol structure - different results

조회 수: 2 (최근 30일)
I G
I G 2018년 11월 4일
답변: Star Strider 2018년 11월 4일
I am using ode45 function to get solution of system of equation with this line of code
[zv, pv] = ode45(@fun2, [1 0], [1; 0]);
where Matlab stores my results in pv, and in zv is saved longitudinal coordinate, where pv=f(zv). And usually I got 73 points stored in zv.
On the other side I need to find second derivative of pv, and I use these lines of code:
sol=ode45(@fun2,[1 0],[1; 0]);
[~,SXINT] = deval(sol,sol.x);
With this commands I got the second derivative of pv only in points sol.x and in that case sol.x consist only 19 points. What is the difference, how in zv I got 73 points? Isn't it the same structure? Because in both cases I am looking for steps, where it means longitudinal coordinate for me? Or is sol.x that what I am looking for?
  댓글 수: 2
madhan ravi
madhan ravi 2018년 11월 4일
you forgot to upload fun function
I G
I G 2018년 11월 4일
편집: I G 2018년 11월 4일
I did it.

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

채택된 답변

Star Strider
Star Strider 2018년 11월 4일
If you look separately at ‘sol.x’, it only has 19 points. If you want to get all the results from your deval call, do this:
[~,SXINT] = deval(sol,zv);
Note that any vector will do in place of ‘zv’ here, providing the values are within the limits of your original tspan vector.

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