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

3 次查看(过去 30 天)
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

采纳的回答

Shadaab Siddiqie
Shadaab Siddiqie 2021-2-23
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by