数字信号处理作业的程序和仿真波形.docx
《数字信号处理作业的程序和仿真波形.docx》由会员分享,可在线阅读,更多相关《数字信号处理作业的程序和仿真波形.docx(10页珍藏版)》请在冰豆网上搜索。
数字信号处理作业的程序和仿真波形
1、
>>n=0:
10;
x=[0,1,0,0,0,0,0,0,0,0,0];
stem(n,x);
gridon
line([0,10],[0,0],'color','r');
xlabel('n'),ylabel('delta[n]');
axis([0,10,-2,2]);
>>
2、
>>n=0:
10;
x2=[0,0,0,0,1,1,1,1,1,1,1];
stem(n,x2);
gridon;
line([0,10],[0,0],'color','r');
xlabel('n'),ylabel('u[n]');
axis([0,10,-2,2]);
>>
3、
>>n=0:
9;
x3=[ones(1,8),0,0];
stem(n,x3);
gridon;
line([0,9],[0,0],'color','r');
xlabel('n'),ylabel('R8[n]');
axis([0,9,-2,2]);
4、>>A=3;
n=-10:
30;
x4=A*sin(pi/5*n+pi/3);
stem(n,x4);
gridon;
line([-10,30],[0,0],'color','r');
line([0,0],[-5,5],'color','r');
xlabel('n'),ylabel('sin[n]');
axis([-10,30,-5,5]);
>>
5、
>>n=0:
9;
x=[1,2,3,4,5,0,0,0,0,0];
stem(n,x);
gridon
line([0,9],[0,0],'color','r');
xlabel('n'),ylabel('delta[n]');
axis([0,9,-2,6]);
>>
6、
>>n=0:
9;
x=[1,2,1,2,0,0,0,0,0,0];
stem(n,x);
gridon
line([0,9],[0,0],'color','r');
xlabel('n'),ylabel('delta[n]');
axis([0,9,-2,3]);
>>
7、
>>n=0:
9;
x=[1,2,1,2,0,0,0,0,0,0];
stem(n,x);
gridon
line([0,9],[0,0],'color','r');
xlabel('n'),ylabel('delta[n]');
axis([0,9,-2,3]);
>>
>>x=[1,2,3,4,5,0,0,0,0,0];
m=2;
n1=0:
(length(x)-1);
n2=0:
(length(x)-1+m);
x1=zeros(1,m+length(x));
fork=m+1:
m+length(x)
x1(k)=x(k-m);
end;
subplot(2,1,1),stem(n1,x);
axis([-2,11,0,5]);
grid;
xlabel('n'),ylabel('x[n]');
subplot(2,1,2),stem(n2,x1);
axis([-2,11,0,5]);
grid;
xlabel('n'),ylabel('x1[n]');
>>x=[1,2,1,2,0,0,0,0,0,0];
m=2;
n1=0:
(length(x)-1);
n2=0:
(length(x)-1+m);
x1=zeros(1,m+length(x));
fork=m+1:
m+length(x)
x1(k)=x(k-m);
end;
subplot(2,1,1),stem(n1,x);
axis([-2,11,0,3]);
grid;
xlabel('n'),ylabel('x[n]');
subplot(2,1,2),stem(n2,x1);
axis([-2,11,0,3]);
grid;
xlabel('n'),ylabel('x1[n]');
>>
>>x=[1,2,3,4,5,0,0,0,0,0];
y=fliplr(x);
n1=0:
9;
n2=-fliplr(n1);
subplot(2,1,1),stem(n1,x);
axis([-10,10,-1,5]);
grid;
xlabel('n'),ylabel('x[n]');
subplot(2,1,2),stem(n2,y);
axis([-10,10,-1,5]);
grid;
xlabel('n'),ylabel('y[n]');
>>
>>x=[1,2,1,2,0,0,0,0,0,0];
y=fliplr(x);
n1=0:
9;
n2=-fliplr(n1);
subplot(2,1,1),stem(n1,x);
axis([-10,10,-1,2]);
grid;
xlabel('n'),ylabel('x[n]');
subplot(2,1,2),stem(n2,y);
axis([-10,10,-1,2]);
grid;
xlabel('n'),ylabel('y[n]');