필터 지우기
필터 지우기

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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by