How to solve a system of 3 ODE and a linear equation.
1 回表示 (過去 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
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Numerical Integration and Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!