About saving output at specific time steps with an ODE solver
Show older comments
Hi there,
I am running matlab ODE function and saving the integrated solution in a file. Each file comes out to be around 1 GB. I do not need the solution (output) barring at a few times during the run. Is there a way to save only these times and the respective output instead of output at each time step? I have an idea of trying to save the output by using a for loop after every run e.g.
T_out=[0 10 20 30...] ; %...time vector of steps at which output needs to b saved
[T out] = ode15s(....); for i-1:length(T_out) if(T==T_out)
save out to file end....
But this takes a lot of time given that there are at times 100000 time steps in the solver output. Is there a faster way to do this ?
Thanks
Answers (2)
TUSHAR ANDRIYAS
on 20 Dec 2012
1 vote
Jan
on 19 Dec 2012
How do you define the input TSPAN for the ODE45 command? Would this help already:
[T, out] = ode15s(@fcn, T_out, y0)
If not, please explain the problem again. Why do you call a FOR loop and how does it look exactly?
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!