How to plot signal with unit step?

32 次查看(过去 30 天)
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)

请先登录,再进行评论。

更多回答(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 CenterFile Exchange 中查找有关 Signal Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by