FINAL EXAM.docx
- 文档编号:10561629
- 上传时间:2023-02-21
- 格式:DOCX
- 页数:19
- 大小:67.66KB
FINAL EXAM.docx
《FINAL EXAM.docx》由会员分享,可在线阅读,更多相关《FINAL EXAM.docx(19页珍藏版)》请在冰豆网上搜索。
FINALEXAM
FINALEXAM
PROBLEM1a:
UsingthefollowingcodeinMatLab:
Num=105;
Den=conv([1,5.792,9.14],[1,4.2,11.847])
%PartA:
PlottheMAGfrequencyresponseofHa(s)
%Atwhatfrequencywillthemagnitudedropby1dBfromitsdcvalue
W=[0:
0.001:
4]';%Omegavector
Ha=freqs(Num,Den,W);%Findsthefrequencyresponse
magHa=abs(Ha);
magHadB=20*log10(magHa);
figure
(1)
plot(W,magHadB);%PlotstheMagnituderesponseindB
xlabel('Frequencyinrad/sec');
ylabel('AmplitudeindB');
title('Final-Part1a:
MagnitudeFREQResponseoftheFilterindB')
omega1=find(magHadB>-1.001&magHadB<-1)
omega1value=W(omega1)
Iobtainedfigure:
IalsoobtainedthefollowingOutputs:
Den=
1.00009.992045.3134107.0058108.2816
omega1=
1093
omega1value=
1.0920
PROBLEM1b:
UsingthefollowingcodeinMatLab:
figure
(2)
plot(W,angle(Ha));
xlabel('Freqinrad/sec');
ylabel('AMP');
title('Phaseresponse');
Iobtainedthefollowingfigure.
PROBLEM1c:
UsingthefollowingcodeinMatLab:
%problem1c
%firstfindT
%FindTbyHandCalculations
%W1=pi/4;
%Givenvalue
%1.092=(2/T)*tan(.25*pi/2)
%T=(2/1.092)*tan(.25*pi/2)=.76
T=0.76;
%Usebilineartransformationtofindx(n)
[b,a]=bilinear(Num,Den,1/T);
w=[0:
pi/1024:
pi]';
tranfun=tf(b,a)
IwasabletodeterimineTandobtainH(z)below;
Transferfunction:
0.1125s^4+0.4498s^3+0.6747s^2+0.4498s+0.1125
--------------------------------------------------------
s^4+0.4715s^3+0.3318s^2+0.0453s+0.006805
PROBLEM1d
UsingthefollowingcodeinMatLab:
%%problem1d
Htran=freqz(b,a,w);
magH=abs(Htran);
magHdB=20*log10(magH);
figure(3)
plot(w,magHdB);%PlotstheMagnituderesponseindB
xlabel('Frequencyinrad/samp');
ylabel('Amplitudeindb');
title('Final-Part1d:
MagnitudeResponseoftheDigitalFilterindB')
figure(4)
plot(w,angle(Htran));
xlabel('FREQinrad/samp');
ylabel('amp');
title('PhaserespHz');
grd=grpdelay(b,a,w);
figure(5)
plot(w,grd);
xlabel('omega');
ylabel('samples');
title('grpdelay');
Iwasabletoobtainthefollowingfigures
PROBLEM1e
UsingthefollowingcodeinMatLab:
%problem1e
w1=pi/4
ind=find(w==w1)%Determinesmagnitudeandphaseatw
magHz_w1=abs(ind)
phaseHz_w1=angle(ind)
figure(6)
subplot(2,1,1)
plot(w/pi,magHz_w1)
xlabel('\omega,NormalizedFrequency')
ylabel('Amplitude')
title('MagnitudeResponseofH(z)atw1')
subplot(2,1,2)
plot(w/pi,phaseHz_w1)
xlabel('\omega,NormalizedFrequency')
ylabel('Radians')
title('PhaseResponseofH(z)atw1')
Iwasabletoplotthefigurebelow:
AndIwasabletodeterminethefollowingoutputs:
w1=
0.7854
ind=
257
magHz_w1=
257
phaseHz_w1=
0
PROBLEM2a
Justbyobservingthisproblem
ExpandingXa3(t)
Iget
Xa3(t)=(pi)^2/3+-4cos(2000*pi*t)+4cos(2000*pi*2*t)/4+-cos(2000*pi*3*t)/9+4cos(2000*pi*4*t)/16
Whichcorrespondstoaperiodicsignalwithfreqs=to1000hz,2000hz,
3000hz,and4000hz
forpartathetypesoffiltersweneedare;
tofilteroutXa3(t)fromXa(t)weneedacombfiltertofilteroutevery500
hzassuch==|pass.5k,1.5k,2.5kand3.5kandwewanttofilterout
1k,2k,3k,4ksoitappearsacombtofilteroutevery1k.
NowtofilteroutXa1(t)andkeepXa2(t)IwilluseanotchfilterbecauseI
wanttofilterout1.5kand2.5kbutatthesametimekeep.5kand3.5k.
Iwillstartwiththenotchbecauseitiseasierforme
UsingthefollowingcodeinMatLab:
(andusing10kforsampling)
f12=500;
f22=1500;
f32=2500;
f42=3500;
fs2=10000;
w122=2*pi*f12/fs2
w222=2*pi*f22/fs2
w322=2*pi*f32/fs2
w422=2*pi*f42/fs2
T22=2;
wp22=[w122,w422];
ws22=[w222,w322];
attp=-20*log10(0.9);%0.9isanumberwechoosetoget1dBinthe
atts=-20*log10(.005);%0.005isanumberwechoosetoget40dbinthestopband
Wp22=(2/T22)*tan(wp22/2);
Ws22=(2/T22)*tan(ws22/2);
[n22,Wn22]=ellipord(Wp22,Ws22,attp,atts,'s');%nistheorderofthefilterthatellipordwilldetermine
[B22,A22]=ellip(n22,attp,atts,Wn22,'stop','s');
[numz2,denz2]=bilinear(B22,A22,1/T22);
omega22=[0:
pi/1024:
pi]';
H22=tf(numz2,denz2,1)
H2=freqz(numz2,denz2,omega22);
Hmag22=abs(H2);
HmagdB2=20*log10(Hmag22);
figure(11)
plot(omega22,Hmag22);
title('magrespindbofourfiltertofilteroutXa1(t)');
IamabletogeneratetheplotbelowtofilteroutXa1(t)tokeepXa2(t)and
obtaintheMatLaboutputsasfollows:
w122=
0.3142
w222=
0.9425
w322=
1.5708
w422=
2.1991
Transferfunction:
0.1265z^6-0.2311z^5+0.4767z^4-0.4624z^3
+0.4767z^2-0.2311z+0.1265
-----------------------------------------------------------
z^6-0.7989z^5-0.267z^4-0.1212z^3+0.6953z^2
-0.004414z-0.2219
Samplingtime:
1
nowIwillattemptacombtofilteroutevery1kasspecifiedabove
fromalpha=1-sinwc/coswc
wherewc=1k
ourcoeffaheadoftffromeq.(1+alpha)/2((1-z^-1)/(1-alphaz^-1))is.65so
hzbecomes
Num=[1,0,0,0,0,0,0,0,-1]*0.65;
Den=[1,0,0,0,0,0,0,0,-.307];
InMatlab.
UsingthefollowingcodeinMatLab:
Num=[1,0,0,0,0,0,0,0,-1]*0.65;
Den=[1,0,0,0,0,0,0,0,-.307];
fs222=10e3;
f222=[0:
fs222/2];
[H_Comb,Faxis]=freqz(Num,Den,f222,fs222);
Faxis=(Faxis*2)/fs222;
figure(12)
plot(Faxis,abs(H_Comb))
title('DigitalIIRCombFilter')
xlabel('\omega/\pi(rads/sample)')
ylabel('Amplitude')
Iobtainthefollowingplotbelow:
PROBLEM3a
Determinetheminsampfreqneededtoconverttodigital
Xa(t)=2sin(2*pi*f1*t)sin(2*pi*f2*t)+4cos(2*pi*f3*t)
Expandtogethighestfreq.
Xa(t)becomes=cos(1800*pi*t)-cos(2200*pi*t)+4cos(2400*pi*t)
Toavoidaliasing:
2*fmax=2*2400*pi=4800*pior2400hz
PROBLEM3b
UsingthefollowingcodeinMatLab:
f1=100;
f2=1000;
f3=1200;
fs=2400;
T3=1/fs;
%omega=2*pi*f
omega_1=2*pi*f1;
omega_2=2*pi*f2;
omega_3=2*pi*f3;
%changexa(t)intodigitalsignal,x(n)
%digitalfrequenciesusingw=omega/fsamp
w11=omega_1/fs;
w22=omega_2/fs;
w33=omega_3/fs;
%Setuptimeindex,n
n3=[0:
T3:
30*pi]';
%Definex(n)
x3=2*sin(w11*n3).*sin(w22*n3)+4*cos(w33*n3);
%Plotx(n)
figure(7);
plot(n3,x3);
title('Discrete-timeSignal,x(n)');
xlabel('Timeindex,n');
ylabel('Amplitude');
gridon;
Iamabletogeneratethefigurebelow:
whichistheplotof
x3=2*sin(w11*n3).*sin(w22*n3)+4*cos(w33*n3);
Fromthecorrespondingfreq’s
PROBLEM3cand3d
UsingthefollowingcodeinMatLab:
S=0.01;
Asl=-20*log10(S);%Relativesidewidthattenuation;Asl=46.0206
delta_ml=w22-w11;%mainlobewidth
N=ceil(24*pi*(Asl+12)/(155*delta_ml))+1
beta=0.76609*(Asl-13.26)^0.4+0.09384*(Asl-13.26);
Iamabletodeterminesomeparametershere:
Asl=
40
N=
12
beta=
5.3612
nowusingthefollowingcodeinMatLab:
w3e=[0:
1024-1]'*2*pi/1024;
n3e=[0:
N-1]';
%KaiserWindow
x33=2*sin(w11*n3e).*sin(w22*n3e)+4*cos(w33*n3e);
kw=kaiser(N,beta);%KaiserWindow
v=x33.*kw;%WindowSequencev(n)
vSpect=fft(v,1024);%FourierTransformofv(n)
mag_V=abs(vSpect(1:
512));
pha_V=angle(vSpect(1:
512));
%theKaiserwindow
figure(8);
stem(n3e,kw);
xlabel('n,samples');
ylabel('Amp');
title('Kaiserwindow');
gridon;
%PlottheWindowSequence,v(n)
figure(9);
stem(n3e,v);
xlabel('n,samples');
ylabel('Amp');
title('WindowSequence,v(n)');
gridon;
%PlottheKaiserwindowwithlengthN
figure(10);
plot(w3e(1:
512)/pi,mag_V)
xlabel('Normalizedfrequency(*\pi)')
ylabel('Magnitude')
title('KaiserWindow')
gridon;
Iamabletogeneratethefollowingplots:
AswecanseefromthelastfigurewhichisourKaiserwindowwithlength
of1whichcorrespondstopi.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- FINAL EXAM