Sum of rectangle function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, how can I create a sum of rectangles?
1 comentario
Respuestas (1)
Ameer Hamza
el 1 de Nov. de 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 comentarios
Ver también
Categorías
Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
