How would I improve my euler code?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Raiven Balderas
le 20 Fév 2018
Modifié(e) : Jim Riggs
le 21 Fév 2018
How can i improve my euler code? Code is attached ... I believe i have to improve it by using trapezoids instead of rectangles..How do i do this ? Can someone help
0 commentaires
Réponse acceptée
Jim Riggs
le 20 Fév 2018
For trapezoidal integration, you use the average of two consecutive evaluations. This could be done by simply adding one line of code after the Euler calculation;
y(:,k+1) = (y(:,k+1) + y(:,k))*h/2
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!