How to plot signal with unit step?

23 ビュー (過去 30 日間)
Bilal  Siddiqui
Bilal Siddiqui 2015 年 9 月 15 日
回答済み: Divine 2023 年 11 月 3 日
I want to plot the following signal in matlab but I am not sure how to do this with the unit step response involved.
x[n] = ((4/5)^n)u[n]
-5 < n < 20

採用された回答

Hamoon
Hamoon 2015 年 9 月 15 日
You can use heaviside function:
n = -5:1:20;
x = ((4/5).^n).*heaviside(n);
stem(n,x)
Bet be aware heaviside(0)=0.5
  3 件のコメント
Hamoon
Hamoon 2015 年 9 月 15 日
you can also use this if you want to have u[0]=0:
n = -5:1:20;
myStep = @(n) (n>0);
x = ((4/5).^n).*myStep(n);
stem(n,x)
Hamoon
Hamoon 2015 年 9 月 15 日
My Pleasure...

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

その他の回答 (2 件)

Kamalika Saha
Kamalika Saha 2022 年 1 月 5 日
n = -5:1:20;
x = ((4/5).^n).*heaviside(n);
stem(n,x)

Divine
Divine 2023 年 11 月 3 日
n = -5:1:20;
x = ((4/5).^n).*heaviside(n);
stem(n,x)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by