MATLAB Answers

How to solve a system of 3 ODE and a linear equation.

20 views (last 30 days)
How to solve a system of 3 ODE
dvdt=z;
dzdt=-v/(L0*C0)-z*R0/L0
dTempdt=R0*((C0*z)^2)/(m_ponte*Cp_Al)
and one linear equation: R=R0*(1+Alfa*(temp(i)-T0)) to consider the resistence variation with temperature instead of constant resistence R0?
F=@(t, v, z, temp) [z; -v/(L0*C0)-z*R0/L0; R0*((C0*z)^2)/(m_ponte*Cp)];
v(1)=-20000;
z(1)=0;
temp(1)=298;
t(1)=0;
for i=1:N
k1 = h*F(t(i), v(i), z(i), temp(i));
k2 = h*F(t(i)+h/2, v(i)+k1(1)/2, z(i)+k1(2)/2, temp(i)+k1(3)/2);
k3 = h*F(t(i)+h/2, v(i)+k2(1)/2, z(i)+k2(2)/2, temp(i)+k2(3)/2);
k4 = h*F(t(i)+h, v(i)+k3(1), z(i)+k3(2), temp(i)+k3(3));
v(i+1) = v(i) + (1/6)*(k1(1)+2*k2(1)+2*k3(1)+k4(1));
z(i+1) = z(i) + (1/6)*(k1(2)+2*k2(2)+2*k3(2)+k4(2));
temp(i+1) = temp(i) + (1/6)*(k1(3)+2*k2(3)+2*k3(3)+k4(3));
end

Accepted Answer

Shadaab Siddiqie
Shadaab Siddiqie on 23 Feb 2021
From my understanding you want to solve an 3rd degree ODE equations. You can go through solve ODE, symbolic variables and expressions and also dsolve for more information.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!