信号与系统.docx
《信号与系统.docx》由会员分享,可在线阅读,更多相关《信号与系统.docx(12页珍藏版)》请在冰豆网上搜索。
信号与系统
1.产生并画出下列信号:
a.单位冲激信号δ(t)与单位脉冲序列δ[t];
b.单位阶跃信号u(t)与单位阶跃序列u[t];
Matlab程序如下:
a.>>n=-10:
10;
y=(n==0);subplot(1,2,1);stem(n,y);title('Impulsesequence');...
xlabel('n');ylabel('delta[n]');...
m=-10:
0.1:
10;...
y=(m==0);subplot(1,2,2);plot(m,y,'b');title('Impulsefunction');...
xlabel('m');ylabel('delta(m)');
b.n=-10:
10;
y=(n>=0);subplot(1,2,1);stem(n,y);...
title('stepsequence');xlabel('n');ylabel('u(n)');...
m=-10:
0.1:
10;...
>>y=(m>=0);subplot(1,2,2);plot(m,y,'r');...
title('stepfunction');xlabel('m');ylabel('u(m)');
2.产生并画出下列信号:
a.在[-2π,2π]的范围内,画出正弦信号sin(t);
b.利用sawtooth函数,在[-5π,5π]的范围内,画出周期三角波和锯齿波;
c.利用square函数,在[-5π,5π]的范围内,画出周期方波;
Matlab程序如下:
a.>>t=-2*pi:
pi/20:
2*pi;
plot(t,sin(t));
title('Sinewave');xlabel('t');ylabel('sin(t)');
b.>>t=-5*pi:
pi/20:
5*pi;
>>x=sawtooth(t,0.5);
>>subplot(2,1,1);plot(t,x);title('Triangularwave');
>>y=sawtooth(t);
>>subplot(2,1,2);plot(t,y);title('Sawtoothwave');
c.>>t=-5*pi:
pi/100:
5*pi;
y=square(t);
plot(t,y);
axis([-5*pi,5*pi,-1.5,1.5]);
title('Squarewave');
xlabel('t');ylabel('y');
3.在[-4π,4π]的范围内,产生sinc函数曲线与diric函数曲线(阶数N=5)
sinc函数定义:
sinc(t)=sin(πt)/πt,diric函数的定义:
diric(t,,N)=sin(Nt/2)/Nsin(t/2)
Matlab程序如下:
t=-4*pi:
pi/20:
4*pi;
>>N=5;
>>subplot(2,1,1);plot(t,sinc(t));...
title('Sincfunction');gridon;xlabel('t');ylabel('sinc(t)');...
subplot(2,1,2);plot(t,diric(t,5));...
title('Diricfunction');gridon;xlabel('t');ylabel('diric(t)');
4.在n=[-10:
10]范围内产生离散信号:
当-3≤n≤3时,x[n]=2n;取其余值时,均为0
Matlab程序如下:
>>n=[-10:
10];
>>x=2*n.*((n<=3)&(n>=-3));
>>stem(n,x);
title('Adiscretesignal');
xlabel('n');ylabel('x[n]');
5.在n=[-10:
10]范围内画出以下信号:
a.X[n]=δ[n];
b.X[n]=δ[n+2];
c.X[n]=δ[n-4];
d.X[x]=2δ[n+2]-δ[n-4];
Matlab程序如下:
n=[-10:
10];
y=(n==0);
subplot(2,2,1);stem(n,y);
y=(n==-2);
>>subplot(2,2,2);stem(n,y);
>>y=(n==4);
subplot(2,2,3);stem(n,y);
>>y=2*(n==-2)-(n==4);
subplot(2,2,4);stem(n,y);
6.产生复信号:
a.x[n]=e0≤n≤32
b.x[n]=e-10≤n≤10
并画出他们的实部和虚部及模值和相角
Matlab程序如下:
a.>>n=0:
32;
>>x=exp(j*(pi/8)*n);
>>subplot(2,2,1);stem(n,real(x));
>>subplot(2,2,2);stem(n,imag(x));
>>subplot(2,2,3);stem(n,abs(x));
>>subplot(2,2,4);stem(n,(180/pi)*angle(x));
b.>>n=0:
32;
>>x=exp((-0.1+j*0.3)*n);
>>subplot(2,2,1);stem(n,real(x));
>>subplot(2,2,2);stem(n,imag(x));
>>subplot(2,2,3);stem(n,abs(x));
>>subplot(2,2,4);stem(n,(180/pi)*angle(x));
7.已知x[n]=u[n]-u[n-10],要求将它进行奇偶分量分解,分解为奇分量x[n]与偶分量x[n]
Matlab程序如下:
>>n=[0:
10];
x=stepseq(0,0,10)-stepseq(10,0,10);
[xe,xo,m]=evenodd(x,n);
subplot(2,2,1);stem(n,x);title('Stepsequence');
xlabel('n');ylabel('x[n]');axis([-10,10,-1.2,1.2]);
subplot(2,2,3);stem(m,xe);title('Evenpart');
xlabel('n');ylabel('xe[n]');axis([-10,10,-1.2,1.2]);
subplot(2,2,4);stem(m,xo);title('Oddpart');
xlabel('n');ylabel('xo[n]');axis([-10,10,-1.2,1.2]);
Stepseq.m和evenodd.m的源程序如下:
stepseq.m
function[x,n]=stepseq(n0,n1,n2)
ifnargin~=3;
disp('Usage:
Y=stepseq(n0,n1,n2)');
return;
elseif((n0n2)|(n1>n2))
error('argumentsmustsatisfyn1end
n=[n1:
n2];
x=[(n-n0)>=0];
evenodd.m
function[xe,xo,m]=evenodd(x,n)
ifany(imag(x)~=0)
error('xisnotarealsequence');
end
m=-fliplr(n);
m1=min([m,n]);m2=max([m,n]);m=m1:
m2;
nm=n
(1)-m
(1);n1=1:
length(n);
x1=zeros(1,length(m));
x1(n1+nm)=x;x=x1;
xe=0.5*(x+fliplr(x));
xo=0.5*(x-fliplr(x));
8.已知序列x[n]当n=0时,x[n]=2;n=2时,x[n]=1;n=3时,x[n]=-1;n=4时,x[n]=3;n为其余值时,x[n]=0
a.画出x[n]
b.画出y[n]=x[n-2]
c.画出y[n]=x[n+1]
d.画出y[n]=x[-n]
Matlab程序如下:
>>n=[-10:
10];
a.x=[zeros(1,10),2,0,1,-1,3,zeros(1,6)];
subplot(2,2,1);stem(n,x);
b.x=[zeros(1,12),2,0,1,-1,3,zeros(1,4)];
subplot(2,2,2);stem(n,x);
c.x=[zeros(1,9),2,0,1,-1,3,zeros(1,7)];
subplot(2,2,3);stem(n,x);
d.x=[zeros(1,6),3,-1,1,0,2,zeros(1,10)];
subplot(2,2,4);stem(n,x);
9.在n=[0:
31]范围内画出下列信号:
a.x[n]=sin()cos()
b.x[n]=sin(n)
>>n=0:
31;
>>x=sin(n*pi/4).*cos(n*pi/4);...
subplot(2,1,1);plot(n,x);...
y=sin(n);...
subplot(2,1,2);plot(n,y);