Solve an ode using ode45

21 views (last 30 days)
Mou Ab
Mou Ab on 24 Mar 2020
Answered: darova on 24 Mar 2020
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

Answers (1)

darova
darova on 24 Mar 2020
SOlution

Tags

Community Treasure Hunt

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

Start Hunting!