Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Using structures instead of vectors?

조회 수: 3 (최근 30일)
Isktaine
Isktaine 2012년 9월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I'm using ode45 and passing the solutions into another function. Currently I am using the notation
[x,A]=ode45('odes',...)
As I need a continuous function I interpolate over x and A to get the value at any point i in the integration range.
A1_x(i)=interpl(x,A(:,1),'spline')
A2_x(i)=interpl(x,A(:,2),'spline')
I have just noticed the structure notation in the MATLAB documentation. Would the accuracy of my continuous function be greatly improved if I used the
sol=ode45(@odes,...)
notation? So now the solver is outputting 'sol' which is a structure. To recode all my functions using this would take a long time but I'm willing to do it if it will improve accuracy/speed.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 9월 18일
That doesn't look like structure notation: that looks like function handle notation. The accuracy of function handle notation is exactly the same.
  댓글 수: 1
Isktaine
Isktaine 2012년 9월 18일
편집: Isktaine 2012년 9월 18일
Sorry, I wasn't clear. It's the 'sol' part that has changed too. To use the structure output, you have to use a function handle notation and that bit is okay. So now the solver is outputting 'sol' which is a structure.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by