Solving two dependent two variable ordinary differential equation
17 views (last 30 days)
Show older comments
Abhishek Varma
on 15 Sep 2020
Answered: Alan Stevens
on 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 Comments
Accepted Answer
Alan Stevens
on 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 Comments
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!