Borrar filtros
Borrar filtros

Odd ODE15s behavior due to tspan argument

2 visualizaciones (últimos 30 días)
Richard Allen
Richard Allen el 1 de Sept. de 2018
Editada: Richard Allen el 5 de Sept. de 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 comentario
Richard Allen
Richard Allen el 5 de Sept. de 2018
Editada: Richard Allen el 5 de Sept. de 2018
Here is the output (from the MATLAB iOS App, but Mac R2017a is identical.
Richard

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by