欢迎来到天天文库
浏览记录
ID:14630397
大小:928.50 KB
页数:20页
时间:2018-07-29
《数字信号处理大作业分析》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、数字信号处理大作业电子工程学院M2.2ThesquarewaveandthesawtoothwavearetwoperiodicsequenceassketchedinFigureP2.1.UsingthefunctionssawtoothandsquarewriteaMATLABprogramtogeneratetheabovetwosequencesandplotthemandtheperiodN.Forthesquarewavesequenceanadditionaluser-specifiedparame
2、teristhedutycycle,whileisthepercentoftheperiodforwhichthesignalispositive.Usingthisprogramgeneratethefirst100samplesofeachoftheabovesequenceswithasamplingrateof20khz,apeakvalueof7,aperiodof13andadutycycleof60%forthesquarewave.如下为matlab程序代码:%getuserinputsa=inp
3、ut('thepeakvalue=');l=input('lengthofsequence=');n=input('theperiodofsequence');ft=input('thedesiredsamplingfrequency=');dc=input('thesquarewavedutycycle=');%creatsingalst=1/ft;t=0:l-1;x=a*sawtooth(2*pi*t/n);y=a*square(2*pi*(t/n),dc);%poltsubplot(211)stem(t,x
4、)ylabel('Amplitude');xlabel(['Timein',num2str(t),'sec']);subplot(212)stem(t,y);ylabel('Amplitude');xlabel(['Timein',num2str(t),'sec']);在仿真之前,分析题目中所给出的数据,需要注意此时的周期为序列的个数13,而非时间周期13s,否则100个取样最终时间才花费0.05s,在图中就无法显示出来。同时占空比很明确的影响方波的取样正负所占比例,这也与占空比所本意相吻合。周期的多少也直接影响
5、一个周期内取样的个数。M2.4(a)WriteaMatlabprogramtogenerateasinusoidalsequencex[n]=Acos(ω0n+φ)andplotthesequenceusingthestemfunction.TheinputdataspecifiedbytheuserarethedesiredlengthL,amplitudeA,theangularfrequencyω0,andthephaseφwhere0<ω0<πand0≤φ≤2π.Usingtheprogramgenera
6、tethesinusoidalsequenceshowninfigure2.15.(b)Generatesinusoidalsequenceswiththeangularfrequenciesgiveninproblem2.2.Determinetheperiodofeachsequencefromtheplotandverifytheresulttheoretically.Answer:如下为matlab代码:>>L=input('Desiredlength=');A=input('Amplitude=');o
7、mega=input('Angularfrequency=');phi=input('Phase=');n=0:L-1;x=A*cos(omega*n+phi);stem(n,x);xlabel('Timeindex');ylabel('Amplitude');title(['omega_{o}=',num2str(omega)]);%%example:Desiredlength=100Amplitude=1.5Angularfrequency=0.1*piPhase=0ω0=0.1πω0=0.14π由理论计算
8、可知其周期t=2pi/0.14pi=100/7,故时间周期T=100,由图中也可明显看出,其波形以100开始循坏,故其周期也为100,相符。.ω0=0.24π理论计算t=2pi/0.24pi=25/3,故其周期为25,由图中也可看出,其图像每25一循坏,周期为25,与理论也相符。w0=0.34pi理论计算t=2pi/0.34pi=100/17,故其周期为100,由图中,基
此文档下载收益归作者所有