return column vector (t(i+1) & y(i+1)) instead of row vector
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ken
le 3 Avr 2022
Réponse apportée : Walter Roberson
le 3 Avr 2022
function [y,t] = euler_timestep(f,t0,tf,alpha,N)
h=(tf-t0)/N;
t(1)=t0;
y(1)=alpha;
for i=1:N
t(i+1)=t(i)+h;
y(i+1)=y(i)+h*f(t(i),y(i));
end
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB 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!