数字信号处理南航.docx
《数字信号处理南航.docx》由会员分享,可在线阅读,更多相关《数字信号处理南航.docx(15页珍藏版)》请在冰豆网上搜索。
数字信号处理南航
ExperimentWorkof
MeasurementTechnology&DigitalSignalProcessing
Studentnumber:
Name:
1、Afinite-durationsequenceoflengthLisgivenas
,DeterminetheN-pointDFTofthissequenceforN≥LusingMATLAB.(L=10,N=100)
Solution:
BasedonDFTformula,thecodeofMATLABtorealizeDFTasfollowed:
N=100;
L=10;
n=0:
N-1;
k=0:
N-1;
xn=[ones(1,L),zeros(1,N-L)];
WN=exp(-j*2*pi/N);
nk=n'*k;
WNnk=WN.^nk;
Xk=xn*WNnk;
figure
(1)
stem(xn)
figure
(2)
stem(abs(Xk))
Theinputsignalisshowedinfigure1.1andtheresultofsimulationisshowedinfigure1.2.
Figure1.1Figure1.2
2、
Determinethe8and16-pointDFTusingMATLAB.
Solution:
BasedonDFTformula,thecodeofMATLABtorealize8-pointDFTasfollowed:
N=8;
L=4;
n=0:
N-1;
k=0:
N-1;
xn=[ones(1,L),zeros(1,N-L)];
WN=exp(-j*2*pi/N);
nk=n'*k;
WNnk=WN.^nk;
Xk=xn*WNnk;
subplot(1,2,1);
stem(xn);
title('x(n)-8点')
subplot(1,2,2);
stem(abs(Xk));
title('X(k)-8点')
Theinputsignalandtheresultofsimulationisshowedinfigure2.1.
Figure2.1
ThecodeofMATLABtorealize8-pointDFTasfollowed:
N=16;
L=4;
n=0:
N-1;
k=0:
N-1;
xn=[ones(1,L),zeros(1,N-L)];
WN=exp(-j*2*pi/N);
nk=n'*k;
WNnk=WN.^nk;
Xk=xn*WNnk;
subplot(1,2,1);
stem(xn);
title('x(n)-16点')
subplot(1,2,2);
stem(abs(Xk));
title('X(k)-16点')
Theinputsignalandtheresultofsimulationisshowedinfigure2.2.
Figure2.2
3、
Determinethe8,32and64-pointFFTusingMATLAB.
Solution:
BasedonDFTformula,thecodeofMATLABtorealize8-pointDFTasfollowed:
N1=8;
N2=32;
N3=64;
L=6;
xn1=[ones(1,L),zeros(1,N1-L)];
xn2=[ones(1,L),zeros(1,N2-L)];
xn3=[ones(1,L),zeros(1,N3-L)];
X1=fft(xn1,N1);
X2=fft(xn2,N2);
X3=fft(xn3,N3);
subplot(3,2,1);
stem(xn1);
title('x(n)-8点')
subplot(3,2,2);
stem(abs(X1));
title('|X(k)|-8点')
subplot(3,2,3);
stem(xn2);
title('x(n)-32点')
subplot(3,2,4);
stem(abs(X2));
title('|X(k)|-32点')
subplot(3,2,5);
stem(xn3);
title('x(n)-64点')
subplot(3,2,6);
stem(abs(X3));
title('|X(k)|-64点')
Theinputsignalandtheresultofsimulationisshowedinfigure3.1.
Figure3.1
4、DetermineaFIRlowpassfilterwithN=21byrectangularandHammingwindowusingMATLAB.Thepassbandedgefrequencyis0.3π.
Solution:
ThecodeofMATLABofrectangularwindowtorealizeFIRlowpassfilterasfollowed.
N=21;
wc=0.3;
hn=fir1((N-1),wc,boxcar(N));
freqz(hn,1);
title('矩形窗,N=21')
TheamplituderesponseandfrequencyresponseofFIRlowpassfilterisshowedinfigure4.1.
Figure4.1
ThecodeofMATLABofhammingwindowtorealizeFIRlowpassfilterasfollowed.
N=21;
wc=0.3;
hn=fir1((N-1),wc,hamming(N));
freqz(hn,1);
title('汉明窗,N=21')
TheamplituderesponseandfrequencyresponseofFIRlowpassfilterisshowedinfigure4.2.
Figure4.2
5、DetermineaFIRlowpassfilterwithN=8and12byrectangularwindowandfrequency-samplingmethodusingMATLAB.Thepassbandedgefrequencyis0.35π.
Solution:
ThecodeofMATLABofrectangularwindowandfrequency-samplingmethodwithN=8torealizeFIRlowpassfilterasfollowed.
M=8;
Wp=0.35*pi;
m=0:
M/2;
Wm=2*pi*m./M;
Ad=[Wm<=Wp];
Hd=Ad.*exp(-j*0.5*M*Wm);
Hd=[Hdconj(fliplr(Hd(2:
M/2)))];
h=real(ifft(Hd));
w=linspace(0,pi,1000);
H=freqz(h,[1],w);
subplot(1,2,1);
plot(w/pi,20*log10(abs(H)));
title('8点频率采样');
xlabel('归一化角频率');
ylabel('增益/分贝');
axis([01-500.5]);
N=8;
wc=0.35;
hn=fir1((N-1),wc,boxcar(N));
w=linspace(0,pi,1000);
[H,m]=freqz(hn,[1],w,'whole');
mag=abs(H);
db=20*log10((mag+eps)/max(mag));
subplot(1,2,2);
plot(w/pi,db);
title('矩形窗,N=8')
xlabel('归一化角频率');
ylabel('增益/分贝');
axis([01-500.5]);
ThesimulationofFIRlowpassfilterisshowedinfigure5.1.
Figure5.1
ThecodeofMATLABofrectangularwindowandfrequency-samplingmethodwithN=12torealizeFIRlowpassfilterasfollowed.
M=12;
Wp=0.35*pi;
m=0:
M/2;
Wm=2*pi*m./M;
Ad=[Wm<=Wp];
Hd=Ad.*exp(-j*0.5*M*Wm);
Hd=[Hdconj(fliplr(Hd(2:
M/2)))];
h=real(ifft(Hd));
w=linspace(0,pi,1000);
H=freqz(h,[1],w);
subplot(1,2,1);
plot(w/pi,20*log10(abs(H)));
title('12点频率采样');
xlabel('归一化角频率');
ylabel('增益/分贝');
axis([01-500.5]);
N=12;
wc=0.35;
hn=fir1((N-1),wc,boxcar(N));
w=linspace(0,pi,1000);
[H,m]=freqz(hn,[1],w,'whole');
mag=abs(H);
db=20*log10((mag+eps)/max(mag));
subplot(1,2,2);
plot(w/pi,db);
title('矩形窗,N=12')
xlabel('归一化角频率');
ylabel('增益/分贝');
axis([01-500.5]);
ThesimulationofFIRlowpassfilterisshowedinfigure5.2
Figure5.2
6、DetermineaFIRChebyshevlowpassfilterthatthepassbandedgefrequencyis500Hzandthestopbandedgefrequencyis600HzusingMATLAB.Thesamplingfrequencyis2000Hz,itsminimumpassbandattenuationis3dBandminimumstopbandattenuationis40dB.
Solution:
ThecodetorealizeChebyshevFIRlowpassfilterasfollowed.
fp=500;
fs=600;
Rp=3;
Rs=40;
Fs=2000;
T=1/Fs;
wp=2*pi*(fp/Fs);
ws=2*pi*(fs/Fs);
wp1=(2/T)*tan(wp/2);