Solving two dependent two variable ordinary differential equation
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Abhishek Varma
am 15 Sep. 2020
Beantwortet: Alan Stevens
am 15 Sep. 2020
I have to solve this system of ODE
dy1/dt = (y2-y1)/6.579
y2/dt = [-(y2-y1)/6.579] + 2.115*[ 40 - 4y2]
Here, i have the initial values as y1in = 0, y2in = 0
Also how can i plot y2 and y1 against time? im new to matlab,please help
0 Kommentare
Akzeptierte Antwort
Alan Stevens
am 15 Sep. 2020
Here's the basic syntax. Look up ode45 in the documentation for more detail.
tspan = [0 2];
y0 = [0, 0];
[t, y] = ode45(@rates,tspan,y0);
plot(t,y(:,1),t,y(:,2))
function dydt = rates(~,y)
dydt = [(y(2)-y(1))/6.579;
-(y(2)-y(1))/6.579+2.115.*(40 - 4*y(2))];
end
0 Kommentare
Weitere Antworten (0)
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!