
Solve an ode using ode45
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!