Sum of rectangle function
4 ビュー (過去 30 日間)
古いコメントを表示
Hello, how can I create a sum of rectangles?
回答 (1 件)
Ameer Hamza
2020 年 11 月 1 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numerical Integration and Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
