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.

 Respuesta aceptada

madhan ravi
madhan ravi el 23 de Mayo de 2020
Editada: madhan ravi el 23 de Mayo de 2020

0 votos

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

Más respuestas (0)

Preguntada:

el 23 de Mayo de 2020

Editada:

el 23 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by