How to solve for dI/dz differential equation using runge kutta 4th order method?
1 回表示 (過去 30 日間)
古いコメントを表示
1 件のコメント
James Tursa
2021 年 11 月 18 日
編集済み: James Tursa
2021 年 11 月 18 日
You have multiple independent variables listed, t and z. I think we need more information about what your overall problem is and what initial or boundary conditions you have.
回答 (1 件)
Sudharsana Iyengar
2021 年 11 月 16 日
use ode45
create a function of your diffrential equations and use ODE 45.
This is an example, do a similar for yours.
function dydt = odefcn(t,y,A,B)
dydt = zeros(2,1);
dydt(1) = y(2);
dydt(2) = (A/B)*t.*y(1);
end
Then call your function
A = 1;
B = 2;
tspan = [0 5];
y0 = [0 0.01];
[t,y] = ode45(@(t,y) odefcn(t,y,A,B), tspan, y0);
plotting result
plot(t,y(:,1),'-o',t,y(:,2),'-.')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!