Sum of rectangle function
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, how can I create a sum of rectangles?
Risposte (1)
Ameer Hamza
il 1 Nov 2020
If by "sum of rectangles" you mean Riemann sum approximation of integral using rectangles, then use cumsum(): https://www.mathworks.com/help/matlab/ref/cumsum.html. For example
t = 0:0.1:10;
y = t.^2;
I = cumsum(y).*gradient(t);
5 Commenti
Vedere anche
Categorie
Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
