How to plot discrete signals (delta equation)

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

回答(1 个)

Abraham Boayue
Abraham Boayue 2018-6-4
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

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by