Limiting "y" output of ODE solvers

4 ビュー (過去 30 日間)
David H
David H 2016 年 4 月 29 日
編集済み: David H 2016 年 4 月 29 日
I am currently running an ODE solver in the form
dy = @(t,y) M*y;
[tout,y_out] = ode45(dy, trange,yinit);
% y_out is a length(trange) by length(yinit) matrix
range_needed = [1:10,100:105]; %for example
y_needed = y_out(:,range_needed);
Essentially I only actually "want" a section of y_out but doing it this way fills lots of the memory with values I don't actually need. Edit: To clarify I want all the time values in trange not some limited value, what I want to limit in the output is the size in the other direction, let us call it the "spatial" direction.
I could use an output function to process the ODE output and only select this bit but the one I have written isn't very good. Is there any way to do what I can do this the ode45 options? Failing that is there a function anyone knows that does this on the FEX?

回答 (1 件)

Torsten
Torsten 2016 年 4 月 29 日
You can exactly specify the times when you want ode45 to provide the solution in "trange".
Best wishes
Torsten.
  1 件のコメント
David H
David H 2016 年 4 月 29 日
Hi Torsten
I actually want to limit the y points not the time points (which are automatically given by passing a vector time to the ode solver).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by