フィルターのクリア

why the time "t" inside the ode solver OutputFcn is not a scalar?

2 ビュー (過去 30 日間)
Ehsan Asadi
Ehsan Asadi 2014 年 12 月 18 日
編集済み: Geoff Hayes 2014 年 12 月 20 日
For an ODE problem that I have, I need to evaluate some values right after each successful ODE step. therefore I decided to use OutputFcn (output function that is supposed to run only successful steps). I wrote a code and here is its summay:
options =odeset('OutputFcn',@My_OutputFcn,));
[T,Y]=ode15s(@ode_func,[simulation_time_start,simulation_time_end],initial_conditions,options]
%%%%%%%%%%%%%%%%%
where the OutputFcn is:
function status = My_OutputFcn(t,y,flag,varargin)
global force
t
force= force+t;
%%%%%%%%%%%%%
but the problem is that in the above method, sometimes the parameter t (time) is a vector rather than being a scalar. Why is that happening and how to fix it?
I am printing "t" in the middle of My_OutputFcn and here is a copy of the command window:
t =
0 0.1500
t =
0.0050
t =
0.0100
t =
0.0150
t =
0.0200
t =
0.0250
t =
0.0300
t =
0.0350
t =
0.0400 0.0450
t =
0.0500
t =
0.0550 0.0600
Any help would be greatly appreciated.

回答 (0 件)

カテゴリ

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