Solving problem with ODE45
Afficher commentaires plus anciens
clc;
clear all;
close all;
[t1,y1] = ode45(@vdp1,[0 20],[2; 0]);
t2(1,:)=t1(1,:);
y2(1,:)=y1(1,:);
figure
plot(t1,y1(:,1),'-o',t1,y1(:,2),'-o')
for i=2:size(t1)
[a,b]=ode45(@vdp1,[0 t1(i) 2*t1(i)],y2(i-1,:));
t2(i,:)=a(2,:);
y2(i,:)=b(2,:);
end
figure
plot(t2,y2(:,1),'-o',t2,y2(:,2),'-o')
Hey guys, when I am solving a function step by step with ODE45, the result is completely different from the direct solution. Can someone tell me why?
2 commentaires
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

