MATLAB Answers

Using structures instead of vectors?

1 view (last 30 days)
Isktaine on 18 Sep 2012
I'm using ode45 and passing the solutions into another function. Currently I am using the notation
As I need a continuous function I interpolate over x and A to get the value at any point i in the integration range.
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
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.


Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 18 Sep 2012
That doesn't look like structure notation: that looks like function handle notation. The accuracy of function handle notation is exactly the same.

  1 Comment

Isktaine on 18 Sep 2012
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by