
Solve an ode using ode45
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
we have
T=10;
%% Discretization data
dt=0.1;
t=0:dt:T;
ds=0.2;
sigma=-5:ds:-4;
%% initial data
z0=0;
z1=1;
y0=[z0;z1];
function dydt = vdp1(t,y,sigma,f)
dydt =[0,1;sigma,0]*y+[0;f];
end
[t,Y] = ode45(@(t,y)vdp1(t,y,sigma,f),t,[z0; z1]);
plot(t,Y(:,1),t,Y(:,2))
xlabel('Time t');
ylabel('Solution y');
legend('y_1','y_2')
The previous program for sigma a constant. Now I want the solution for each sigma where
segma=-5:0.2:-4
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!