DSP实验答案Solutionlab5精.docx
《DSP实验答案Solutionlab5精.docx》由会员分享,可在线阅读,更多相关《DSP实验答案Solutionlab5精.docx(12页珍藏版)》请在冰豆网上搜索。
DSP实验答案Solutionlab5精
Name:
Section:
LaboratoryExercise5
LINEAR,TIME-INVARIANTDISCRETE-TIMESYSTEMS:
FREQUENCY-DOMAINREPRESENTATIONS
5.1TRANSFERFUNCTIONANDFREQUENCYRESPONSE
Project5.1TransferFunctionAnalysis
Answers:
Q5.2TheplotofthefrequencyresponseofthecausalLTIdiscrete-timesystemofQuestionQ5.2obtainedusingthemodifiedprogramisgivenbelow:
Thetypeoffilterrepresentedbythistransferfunctionis-BF
5.2TYPESOFTRANSFERFUNCTIONS
Project5.2Filters
AccordingtoProgrammeP4_1.
Answers:
Q5.8TherequiredmodificationstoProgramP4_1tocomputeandplottheimpulseresponseoftheFIRlowpassfilterofProject4.2withalengthof20andacutofffrequencyofωc=0.45
areasindicatedbelow:
clf;
fc=0.45;
n=[-10:
1:
10];
y=2*fc*sinc(2*fc*n;k=n+10;
stem(k,y;title('N=20';axis([020-0.20.6];
xlabel('Timeindexn';ylabel('Amplitude';grid;
Theplotgeneratedbyrunningthemodifiedprogramisgivenbelow:
Q5.20TheplotsoftheimpulseresponsesofthefourFIRfiltersgeneratedbyrunningProgramP4_3aregivenbelow
:
Fromtheplotswemakethefollowingobservations:
Filter#1isoflength____9___witha__symmetrical____impulseresponseandisthereforeaType_1_linear-phaseFIRfilter.
Filter#2isoflength____10__witha__antisymmetric____impulseresponseandisthereforeaType_2_linear-phaseFIRfilter.
Filter#3isoflength___9_____witha___symmetrical____impulseresponseandisthereforeaType_3_linear-phaseFIRfilter.
Filter#4isoflength__10_____witha__antisymmetric___impulseresponseandisthereforeaType_4_linear-phaseFIRfilter.
FromthezerosofthesefiltersgeneratedbyProgramP4_3weobservethat:
Filter#1haszerosatz=2.3273+2.0140i2.3273-2.0140i
-1.2659+2.0135i-1.2659-2.0135i
-0.2238+0.3559i-0.2238-0.3559i
0.2457+0.2126i0.2457-0.2126i
Filter#2haszerosatz=2.5270+2.0392i2.5270-2.0392i
-1.0101+2.1930i-1.0101-2.1930i
-1.0000
-0.1733+0.3762i-0.1733-0.3762i
0.2397+0.1934i0.2397-0.1934i
Filter#3haszerosatz=-1.00000.2602+1.2263i
0.2602-1.2263i1.0000
0.6576+0.7534i0.6576-0.7534i
0.1655+0.7803i0.1655-0.7803i
Filter#4haszerosatz=2.0841+2.0565i2.0841-2.0565i
-1.5032+1.9960i-1.5032-1.9960i
1.0000
-0.2408+0.3197i-0.2408-0.3197i
0.2431+0.2399i0.2431-0.2399i
PlotsofthephaseresponseofeachofthesefiltersobtainedusingMATLABareshownbelow
:
Fromtheseplotsweconcludethateachofthesefiltershave____linear___phase.
ThegroupdelayofFilter#1is-4
ThegroupdelayofFilter#2is–4.5
ThegroupdelayofFilter#3is-4
ThegroupdelayofFilter#4is–4.5
5.3STABILITYTEST
AccordingtoProgrammeP4_4.
Answers:
Q5.23Thepole-zeroplotsofH1(zandH2(zobtainedusingzplaneareshownbelow:
Fromtheabovepole-zeroplotsweobservethat-
Q5.24UsingProgramP4_4wetestedthestabilityofH1(zandarriveatthefollowingstabilitytestparameters{ki}:
-0.99890.8500
FromtheseparametersweconcludethatH1(zis_____stable________.
UsingProgramP4_4wetestedthestabilityofH2(zandarriveatthefollowingstabilitytestparameters{ki}:
-1.00050.8500
FromtheseparametersweconcludethatH2(zis____unstable_________.5.4spectrograms
Background:
Aspectrogramofatimesignalisatwo-dimensionrepresentationthatdisplaystimeinitshorizontalaxisandfrequencyinitsverticalaxis.Agrayscaleistypicallyusedtoindicatetheenergyateachpoint.“white”:
lowenergy,“black”:
highenergy.
Tasks:
ProduceaspectrograminMatlabandthencompareitwithspecgram.minMatlabto
assurewhatyoudidisright.
Outline:
Toproduceaspectrogram,youwillneedtoassemblemanyindividualspectralslices-producedviatheFouriertransform-fromsuccessivesegmentsofaspeechsignal.The
basicoperationsrequiredare
•loadingaspeechsignal
•selectingindividualtimesegmentsofthespeechsignal
•usingtheFFTtotransformfromthetimedomaintothefrequencydomain
•extractingthelogmagnitudespectrum
•assemblingthesequenceofspectraintoa2Dtime-frequencymatrix
•displayingthematrixasanimage
YouwilllearnhowtowriteMATLABscriptsandfunctionstoproducespectrogramsfromsignals.YouwillalsouseMATLAB'splottingfacilitiestodisplaysignalsasameansofcheckingthatyourcodeisdoingtherightthing.
Q5.25
a.LoadthesuppliedspeechsignalintoMATLABusingthecommand:
[y,fs,nbits]=wavread('oilyrag.wav';
b.Designaprogrammetodividethisspeechintoseveralframes,andcompareitwiththe
command‘buffer’.
x=wavread('oilyrag.wav';
%调用自己的分帧函数
w=256;
ov=128;
y=fenzhen(x,w,ov;
%调用matlab的分帧函数
z=buffer(x,w,ov;
functiony=fenzhen(x,w,ov
%===分帧函数
if(size(x,1>size(x,2
x=x';
s=length(x;
ifnargin<2
w=256;
end
ifnargin<3
ov=w/2;
end
h=w-ov;
c=1;
ncols=1+fix((s-w/h;
d=zeros(w,ncols;
forb=0:
h:
(s-w
d(:
c=x((b+1:
(b+w';
c=c+1;
end
y=d;
c.Designaprogrammetosynthesizetheframedspeechtoasectionofspeech.functiony=hecheng(x,ov
%==合成语音
[framlengframnum]=size(x;
ifnargin<2
ov=framleng/2;
end
h=framleng-ov;
sigleng=h*(framnum-1+framleng;
d=zeros(1,sigleng;
fori=1:
framnum
d(((i-1*h+1:
((i-1*h+framleng=d(((i-1*h+1:
((i-1*h+framleng+x(:
i';
y=d;
d.Designaprogrammetorepresentthespectrogramofasectionofspeech,andcompareitwiththecomman
d‘specgram’.
[x,sr]=wavread('Tea_10kHz_16bit.wav';
%调用自己的语谱程序
y=my_specgram(x,sr,256,128;
%调用matlab的语谱程序
figure,
specgram(xfunctiony=my_specgram(x,sr,w,ov%====语谱程序if(size(x,1>size(x,2x=x';ends=length(x;ifnargin<2sr=1;endifnargin<3w=256;endifnargin<4ov=w/2;endh=w-ov;win=hanning(w';c=1;ncols=1+fix((s-w/h;d=zeros(1+w/2,ncols;forb=0:
h:
(s-wu=win.*x((b+1:
(b+w;t=fft(u;%ƵÓòÊý¾Ýd(:
c=t(1:
(1+w/2';c=c+1;endtt=[0:
h:
(s-w]/sr;ff=[0:
(w/2]*sr/w;ifnargout<1axisxyxlabel('Time/s';ylabel('Frequency/Hz';elsey=d;imagesc(tt,ff,20*log10(abs(d;axisxyxlabel('Time/s';ylabel('Frequency/Hz'endimagesc(tt,ff,20*log10(abs(d;Date:
Signature: