Trapezoidal numerical integration using for loops
Ältere Kommentare anzeigen
Hi there,
I'm trying to create a for loop that calcuates the trapezoidal rule for a arrray of x and fx values without using the trapz function at different x points.
e.g.
x = 0, 0.25, 0.5, 0.75, 1
y = 0, 0.03, 0.006, 0.001, 0.06
Can someone please provide some guidance
Antworten (1)
James Tursa
am 30 Sep. 2022
Bearbeitet: James Tursa
am 30 Sep. 2022
0 Stimmen
See the Trapezoidal Method section here for the fomula:
or here:
Just write a for-loop to calculate the sum shown.
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!