How would I improve my euler code?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Jim Riggs
2018년 2월 20일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!