Hello, I want to make function Runge-Kutta orde 4 with equation depend on time, but in MATLAB i get some error
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
cindyawati cindyawati
le 19 Mai 2023
Commenté : Cris LaPierre
le 20 Mai 2023
I want to use this equation with runge-kutta orde 4
function M1 =fRK4M1(M1)
%M1 =M1(j)+1./(1+exp(-T(j)));
m1 = (50*M1(j+1)*(1-(M1(j+1)/75))-2*(10^-4)*M1(j+1)*M1(j+1)-M1(j+1)*((5*10^-4).*M2(j+1))-((10-3)*(10^-4)*M1(j+1)*M3(j+1))-((100-10)*0.1*M1(j+1)*O(j+1))-((10^-3)*M1(j+1)));
M1 = dt *m1;
end
0 commentaires
Réponse acceptée
Cris LaPierre
le 19 Mai 2023
You have not defined j, so in MATLAB, by default that letter is used to create complex numbers. As the error message states, your index must be positive integers.
j+1
a=1:5;
a(j+1)
2 commentaires
cindyawati cindyawati
le 20 Mai 2023
Modifié(e) : Cris LaPierre
le 20 Mai 2023
Cris LaPierre
le 20 Mai 2023
Keep in mind that MATLAB is case sensitive. T and t are different variables.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!