Sum of rectangle function

Hello, how can I create a sum of rectangles?

1 件のコメント

Ameer Hamza
Ameer Hamza 2020 年 11 月 1 日
What do you mean by sum of rectangles?

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 1 日

0 投票

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 件のコメント

Amir Delavari
Amir Delavari 2020 年 11 月 1 日
My task is to create a sum of rectangular pulse functions
Ameer Hamza
Ameer Hamza 2020 年 11 月 1 日
Can you show the mathematical formula for the function?
Amir Delavari
Amir Delavari 2020 年 11 月 1 日
Ameer Hamza
Ameer Hamza 2020 年 11 月 2 日
How the rect() function is defined?
Amir Delavari
Amir Delavari 2020 年 11 月 2 日

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeNumerical Integration and Differential Equations についてさらに検索

質問済み:

2020 年 11 月 1 日

コメント済み:

2020 年 11 月 2 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by