フィルターのクリア

Odd ODE15s behavior due to tspan argument

2 ビュー (過去 30 日間)
Richard Allen
Richard Allen 2018 年 9 月 1 日
編集済み: Richard Allen 2018 年 9 月 5 日
Can anyone explain why ode15s results are sensitive to the tspan input? I thought the solver just interpolated between time points at the tspan argument pointz. But running the below (in 2017a) gives odd behaviour for me. Specifically, even at similar times the results are markedly different across each example.
% oscillating decaying function
% same function deltaT=0.01
[T1,Y1]=ode15s(@(t,x) -0.06*exp(-0.03*t)+0.2*cos(t),0:0.01:100,7);
% same function deltaT=1
[T2,Y2]=ode15s(@(t,x) -0.06*exp(-0.03*t)+0.2*cos(t),0:1:100,7);
% same function deltaT=10
[T3,Y3]=ode15s(@(t,x) -0.06*exp(-0.03*t)+0.2*cos(t),0:10:100,7);
% same function deltaT=10
[T4,Y4]=ode15s(@(t,x) -0.06*exp(-0.03*t)+0.2*cos(t),[0 100],7);
Tal=0:0.1:100;
t=0:1:100;
%analytical solution
y=5+2*exp(-0.03*t)+0.2*sin(t);
figure(gcf)
%compare all
plot(T1,Y1,T2,Y2,T3,Y3,T4,Y4,t,y)
legend({'DT=0.01','DT=1','DT=10','start and end','Analytical'})
xlabel('Time')
ylabel('Y')
figure(gcf)
  1 件のコメント
Richard Allen
Richard Allen 2018 年 9 月 5 日
編集済み: Richard Allen 2018 年 9 月 5 日
Here is the output (from the MATLAB iOS App, but Mac R2017a is identical.
Richard

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by