数字信号处理实验报告3.docx
《数字信号处理实验报告3.docx》由会员分享,可在线阅读,更多相关《数字信号处理实验报告3.docx(27页珍藏版)》请在冰豆网上搜索。
数字信号处理实验报告3
Name:
CHENYIFANV20112121006
Section:
LaboratoryExercise3
DISCRETE-TIMESIGNALS:
FREQUENCY-DOMAINREPRESENTATIONS
3.1DISCRETE-TIMEFOURIERTRANSFORM
Project3.1DTFTComputation
AcopyofProgramP3_1isgivenbelow:
%ProgramP3_1
%EvaluationoftheDTFT
clf;
%ComputethefrequencysamplesoftheDTFT
w=-4*pi:
8*pi/511:
4*pi;
num=[21];den=[1-0.6];
h=freqz(num,den,w);
%PlottheDTFT
subplot(2,1,1)
plot(w/pi,real(h));grid
title('RealpartofH(e^{j\omega})')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,imag(h));grid
title('ImaginarypartofH(e^{j\omega})')
xlabel('\omega/\pi');
ylabel('Amplitude');
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
title('MagnitudeSpectrum|H(e^{j\omega})|')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,angle(h));grid
title('PhaseSpectrumarg[H(e^{j\omega})]')
xlabel('\omega/\pi');
Answers:
Q3.1TheexpressionoftheDTFTbeingevaluatedinProgramP3_1is-
Thefunctionofthepausecommandis-causesM-filestostopandwaitforyoutopressanykeybeforecontinuing.
Q3.2TheplotsgeneratedbyrunningProgramP3_1areshownbelow:
TheDTFTisaperiodfunctionofω.
Itsperiodis-2pi
Thetypesofsymmetriesexhibitedbythefourplotsareasfollows:
RealpartofH(e^{j\omega})isevesymmetries;
ImaginarypartofH(e^{j\omega})isodesymmetries;
MagnitudeSpectrum|H(e^{j\omega})|isevesymmetries;
PhaseSpectrumarg[H(e^{j\omega})]isodesymmetries;
Q3.3TherequiredmodificationstoProgramP3_1toevaluatethegivenDTFTofQ3.3aregivenbelow:
%ProgramQ3_3
%EvaluationoftheDTFT
clf;
%ComputethefrequencysamplesoftheDTFT
w=0:
pi/511:
pi;
num=[0.7-0.50.31];den=[10.3-0.50.7];
h=freqz(num,den,w);
%PlottheDTFT
subplot(2,1,1)
plot(w/pi,real(h));grid
title('RealpartofH(e^{j\omega})')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,imag(h));grid
title('ImaginarypartofH(e^{j\omega})')
xlabel('\omega/\pi');
ylabel('Amplitude');
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
title('MagnitudeSpectrum|H(e^{j\omega})|')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,angle(h));grid
title('PhaseSpectrumarg[H(e^{j\omega})]')
xlabel('\omega/\pi');
ylabel('Phase,radians');
TheplotsgeneratedbyrunningthemodifiedProgramP3_1areshownbelow:
TheDTFTisaperiofunctionofω.
Itsperiodis–2pi
Thejumpinthephasespectrumiscausedby-Changerealcomponent,sochangephase
Thephasespectrumevaluatedwiththejumpremovedbythecommandunwrapisasgivenbelow:
%ProgramQ3_3_1
%EvaluationoftheDTFT
clf;
%ComputethefrequencysamplesoftheDTFT
w=0:
pi/511:
pi;
num=[0.7-0.50.31];den=[10.3-0.50.7];
h=freqz(num,den,w);
subplot(2,1,1)
plot(w/pi,abs(h));grid
title('MagnitudeSpectrum|H(e^{j\omega})|')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,1,2)
p=angle(h(:
));
plot(w/pi,unwrap(p));grid
title('PhaseSpectrumarg[H(e^{j\omega})]')
xlabel('\omega/\pi');
ylabel('Phase,radians');
ct3.2DTFTProperties
Answers:
Q3.6ThemodifiedProgramP3_2createdbyaddingappropriatecommentstatements,andaddingprogramstatementsforlabelingthetwoaxesofeachplotbeinggeneratedbytheprogramisgivenbelow:
%ProgramP3_2
%Time-ShiftingPropertiesofDTFT
clf;
w=-pi:
2*pi/255:
pi;wo=0.4*pi;D=10;
num=[123456789];
h1=freqz(num,1,w);
h2=freqz([zeros(1,D)num],1,w);
subplot(2,2,1)
plot(w/pi,abs(h1));grid
title('MagnitudeSpectrumofOriginalSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,2,2)
plot(w/pi,abs(h2));grid
title('MagnitudeSpectrumofTime-ShiftedSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,2,3)
plot(w/pi,angle(h1));grid
title('PhaseSpectrumofOriginalSequence')
xlabel('\omega/\pi');
ylabel('Phase,radians');
subplot(2,2,4)
plot(w/pi,angle(h2));grid
title('PhaseSpectrumofTime-ShiftedSequence')
xlabel('\omega/\pi');
ylabel('Phase,radians');
Theparametercontrollingtheamountoftime-shiftis-D=10,[zeros(1,D)num]
Q3.10ThemodifiedProgramP3_3createdbyaddingappropriatecommentstatements,andaddingprogramstatementsforlabelingthetwoaxesofeachplotbeinggeneratedbytheprogramisgivenbelow:
%ProgramP3_3
%Time-ShiftingPropertiesofDTFT
clf;
w=-pi:
2*pi/255:
pi;wo=0.4*pi;
num1=[1357911131517];
L=length(num1);
h1=freqz(num1,1,w);
n=0:
L-1;
num2=exp(wo*i*n).*num1;
h2=freqz(num2,1,w);
subplot(2,2,1)
plot(w/pi,abs(h1));grid
title('MagnitudeSpectrumofOriginalSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,2,2)
plot(w/pi,abs(h2));grid
title('MagnitudeSpectrumofTime-ShiftedSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,2,3)
plot(w/pi,angle(h1));grid
title('PhaseSpectrumofOriginalSequence')
xlabel('\omega/\pi');
ylabel('Phase,radians');
subplot(2,2,4)
plot(w/pi,angle(h2));grid
title('PhaseSpectrumofTime-ShiftedSequence')
xlabel('\omega/\pi');
ylabel('Phase,radians');
Theparametercontrollingtheamountoffrequency-shiftis-1
Q3.14ThemodifiedProgramP3_4createdbyaddingappropriatecommentstatements,andaddingprogramstatementsforlabelingthetwoaxesofeachplotbeinggeneratedbytheprogramisgivenbelow:
%ProgramP3_4
%ConvolutionPropertyofDTFT
clf;
w=-pi:
2*pi/255:
pi;
x1=[1357911131517];
x2=[1-23-21];
y=conv(x1,x2);
h1=freqz(x1,1,w);
h2=freqz(x2,1,w);
hp=h1.*h2;
h3=freqz(y,1,w);
subplot(2,2,1)
plot(w/pi,abs(hp));grid
title('ProductofMagnitudeSpectra')
xlabel('\omega/\pi');
ylabel('ProductofAmplitude');
subplot(2,2,2)
plot(w/pi,abs(h3));grid
title('MagnitudeSpectrumofConvolvedSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,2,3)
plot(w/pi,angle(hp));grid
title('SumofPhaseSpectra')
xlabel('\omega/\pi');
ylabel('Phase,radians');
subplot(2,2,4)
plot(w/pi,angle(h3));grid
title('PhaseSpectrumofConvolvedSequence')
xlabel('\omega/\pi');
ylabel('Phase,radians');
Q3.17ThemodifiedProgramP3_5createdbyaddingappropriatecommentstatements,andaddingprogramstatementsforlabelingthetwoaxesofeachplotbeinggeneratedbytheprogramisgivenbelow:
%ProgramP3_5
%ModulationPropertyofDTFT
clf;
w=-pi:
2*pi/255:
pi;
x1=[1357911131517];
x2=[1-11-11-11-11];
y=x1.*x2;
h1=freqz(x1,1,w);
h2=freqz(x2,1,w);
h3=freqz(y,1,w);
subplot(3,1,1)
plot(w/pi,abs(h1));grid
title('MagnitudeSpectrumofFirstSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(3,1,2)
plot(w/pi,abs(h2));grid
title('MagnitudeSpectrumofSecondSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(3,1,3)
plot(w/pi,abs(h3));grid
title('MagnitudeSpectrumofProductSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
Q3.20ThemodifiedProgramP3_6createdbyaddingappropriatecommentstatements,andaddingprogramstatementsforlabelingthetwoaxesofeachplotbeinggeneratedbytheprogramisgivenbelow:
%ProgramP3_6
%Time-ReversalPropertyofDTFT
clf;
w=-pi:
2*pi/255:
pi;
num=[1234];
L=length(num)-1;
h1=freqz(num,1,w);
h2=freqz(fliplr(num),1,w);
h3=exp(w*L*i).*h2;
subplot(2,2,1)
plot(w/pi,abs(h1));grid
title('MagnitudeSpectrumofOriginalSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,2,2)
plot(w/pi,abs(h3));grid
title('MagnitudeSpectrumofTime-ReversedSequence')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,2,3)
plot(w/pi,angle(h1));grid
title('PhaseSpectrumofOriginalSequence')
xlabel('\omega/\pi');
ylabel('Phase,radians');
subplot(2,2,4)
plot(w/pi,angle(h3));grid
title('PhaseSpectrumofTime-ReversedSequence')
xlabel('\omega/\pi');
ylabel('Phase,radians');
Theprogramimplementsthetime-reversaloperationasfollows-Firstofall,usingthereversefunctionwillrowvectorofmolecularcoefficientinversion,thatis,fromtheoriginal[1,2,3,4]gonebadnow[4321],andthenafterthecoefficientinversionsequencemultipliedbytheexp(L*w*I),makealltheoriginalmoleculesexp(-w*I)intotheexp(w*I),sothex(n),thustorealizetheflipoperationtime
Fromtheseplotswemakethefollowingobservations:
3.2DISCRETEFOURIERTRANSFORM
Project3.3DFTandIDFTComputations
Answers:
Q3.23TheMATLABprogramtocomputeandplottheL-pointDFTX[k]ofalength-Nsequencex[n]withL
NandthentocomputeandplottheIDFTofX[k]isgivenbelow:
%ProgramQ3.23
clf;
%ComputethefrequencysamplesoftheDTFT
n=0:
9;
L=12;
x1=[0123456789];
x2=[x1,zeros(1,L-length(x1))];
h1=fft(x1);
h2=fft(x2,L);
h3=ifft(h1);
subplot(3,1,1)
stem(n,h1);grid
title('N点离散傅里叶变换')
xlabel('n');
ylabel('Amplitude');
subplot(3,1,2)
stem(h2);grid
title('L点离散傅里叶变换')
xlabel('n');
ylabel('Amplitude');
subplot(3,1,3)
stem(n,h3);grid
title('离散傅里叶逆变换')
xlabel('n');
ylabel('Amplitude');
TheDFTan