Hi all, I hope everyone is doing well and safe!
I have 4 differntionl equtions and I need to solve them in ode45, I tried to do it in different ways but no luck! the four equtions:
dy(1) = vas-y(2)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(1));
dy(2) = y(1)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(2));
dy(3) = 0-0.49*y(4)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(3));
dy(4) = 0-0.49*y(3)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(4));
I need to plot them as well. Any help will be appreciated.

 Réponse acceptée

madhan ravi
madhan ravi le 23 Mai 2020
Modifié(e) : madhan ravi le 23 Mai 2020

0 votes

ic=randi([0,1],4,1)
ode45(@(t,y)myfunc(t,y,5),[0,10],ic)
function dy = myfunc(t,y,vas)
dy=zeros(4,1);
dy(1) = vas-y(2)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(1));
dy(2) = y(1)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(2));
dy(3) = 0-0.49*y(4)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(3));
dy(4) = 0-0.49*y(3)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(4));
end

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by