Azzera filtri
Azzera filtri

How to plot signal with unit step?

32 visualizzazioni (ultimi 30 giorni)
Bilal  Siddiqui
Bilal Siddiqui il 15 Set 2015
Risposto: Divine il 3 Nov 2023
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

Risposta accettata

Hamoon
Hamoon il 15 Set 2015
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 Commenti
Hamoon
Hamoon il 15 Set 2015
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 il 15 Set 2015
My Pleasure...

Accedi per commentare.

Più risposte (2)

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

Divine
Divine il 3 Nov 2023
n = -5:1:20;
x = ((4/5).^n).*heaviside(n);
stem(n,x)

Categorie

Scopri di più su Signal Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by