How to plot discrete signals (delta equation)

89 visualizzazioni (ultimi 30 giorni)
Jhon
Jhon il 3 Giu 2018
Risposto: Abraham Boayue il 4 Giu 2018
plot 2 discrete signals:
1.x[n]=delta[n]-delta[n-1]+delta[n+4]
2.y[n]=0.5^n*u[n]
also plot the convolution I don't know what the delta is supposed to be and how to approach these kind of signals
if I have a simple signal I know how to do it n = 0:7; x1 = cos(pi*n); subplot(1,2,1) stem(n,x1)

Risposte (1)

Abraham Boayue
Abraham Boayue il 4 Giu 2018
Take a look at this code. It shows how to plot the sequences that you are given.
n0 = 0;
n1 = 1;
n2 = -4;
n = -5:5;
xn = ((n-n0)==0)-((n-n1)==0)+((n-n2)==0); % The delta function
yn = 0.5*((n-n0)>=0);
figure
subplot(121)
stem(n,xn,'linewidth',3,'color','b')
a= title('Discrete time signal: Unit sample sequence');
set(a,'fontsize',14);
a= xlabel('n [-5 5]');
set(a,'fontsize',20);
a = ylabel('xn');
set(a,'fontsize',20);
grid
subplot(122)
stem(n,yn,'linewidth',3,'color','r')
a= title('Discrete time signal: Unit Step sequence');
set(a,'fontsize',14);
a= xlabel('n [-5 5]');
set(a,'fontsize',20);
a = ylabel('yn');
set(a,'fontsize',20);
grid

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by