Sum of rectangle function
Afficher commentaires plus anciens
Hello, how can I create a sum of rectangles?
1 commentaire
Ameer Hamza
le 1 Nov 2020
What do you mean by sum of rectangles?
Réponses (1)
Ameer Hamza
le 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 commentaires
Amir Delavari
le 1 Nov 2020
Ameer Hamza
le 1 Nov 2020
Can you show the mathematical formula for the function?
Amir Delavari
le 1 Nov 2020
Ameer Hamza
le 2 Nov 2020
How the rect() function is defined?
Amir Delavari
le 2 Nov 2020
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
