Effacer les filtres
Effacer les filtres

Odd ODE15s behavior due to tspan argument

2 vues (au cours des 30 derniers jours)
Richard Allen
Richard Allen le 1 Sep 2018
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 commentaire
Richard Allen
Richard Allen le 5 Sep 2018
Modifié(e) : Richard Allen le 5 Sep 2018
Here is the output (from the MATLAB iOS App, but Mac R2017a is identical.
Richard

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by