How to solve for dI/dz differential equation using runge kutta 4th order method?

1 vue (au cours des 30 derniers jours)
ANAM SAIFI
ANAM SAIFI le 16 Nov 2021
Modifié(e) : James Tursa le 18 Nov 2021
  1 commentaire
James Tursa
James Tursa le 18 Nov 2021
Modifié(e) : James Tursa le 18 Nov 2021
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.

Connectez-vous pour commenter.

Réponses (1)

Sudharsana Iyengar
Sudharsana Iyengar le 16 Nov 2021
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),'-.')

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by