版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
數(shù)字信號(hào)處理上機(jī)實(shí)驗(yàn)報(bào)告2018年5月21日 M2.2題目ThesquarewaveandthesawtoothwavearetwoperiodicsequencesassketchedinfigureP2.4.Usingthefunctionstem.Theinputdataspecifiedbytheuserare:desiredlengthLofthesequence,peakvalueA,andtheperiodN.Forthesquarewavesequenceanadditionaluser-specifiedparameteristhedutycycle,whichisthepercentoftheperiodforwhichthesignalispositive.Usingthisprogramgeneratethefirst100samplesofeachoftheabovesequenceswithasamplingrateof20kHz,apeakvalueof7,aperiodof13,andadutycycleof60%forthesquarewave.程序clc;closeall;f=20000;%采樣頻率L=100*(1/f);%采樣個(gè)數(shù)A=7;%最大值N=13;%周期t=0:1/20000:L-1/20000;%t=0:1:20;y1=(A*sawtooth(2*pi/N*f*t));m=(A-max(y1))/2;y2=m+y1;figure(1);subplot(2,1,1);stem(t,y2);y3=square(2*pi/13*20000*t,60);subplot(2,1,2)stem(t,y3);結(jié)果M2.4題目Writeamatlabprogramtogenerateasinusoidalsequencex[n]=Acos(ω0n+Ф)andplotthesequenceusingthestemfunction.TheinputdataspecifiedbytheuserarethedesiredlengthL,amplitudeA,theangularfrequencyω0,andthephaseФwhere0<ω0<piand0<=Ф<=2pi.Usingthisprogramgeneratethesinusoidalsequencesshowninfigure2.15.GeneratesinusoidalsequenceswiththeangularfrequenciesgiveninProblem2.22.Determinetheperiodofeachsequencefromtheplotandverifytheresulttheoretically.程序clc;clearall;closeall;L=input('Desiredlength=');A=input('Amplitude=');omega=input('Angularfrequency=');phi=input('Phase=');%信號(hào)產(chǎn)生n=0:L-1;x=A*cos(omega*n+phi);stem(n,x);xlabel('n');ylabel('幅度');title(['\omega_{o}=',num2str(omega)]);結(jié)果ω0=0ω0=0.1πω0=0.8πω0=1.2πω0=0.14πω0=0.24πω0=0.34πω0=0.68πω0=0.75πM2.5題目Generatethesequencesofproblem2.21(b)to2.21(e)usingmatlab.程序(b)n=0:99;x=sin(0.6*pi*n+0.6*pi);stem(n,x);xlabel('n');ylabel('幅度');(c)n=0:99;x=2*cos(1.1*pi*n-0.5*pi)+2*sin(0.7*pi*n);stem(n,x);xlabel('n');ylabel('幅度');(d)n=0:99;x=3*sin(1.3*pi*n-4*cos(0.3*pi*n+0.45*pi));stem(n,x);xlabel('n');ylabel('幅度');(e)n=0:99;x=5*sin(1.2*pi*n+0.65*pi)+4*sin(0.8*pi*n)-cos(0.8*pi*n);stem(n,x);xlabel('n');ylabel('幅度');(f)n=0:99;x=mod(n,6);stem(n,x);xlabel('n');ylabel('幅度');結(jié)果(b)(c)(d)(e)(f)M2.6題目Writeamatlabprogramtoplotacontinuous-timesinusoidalsignalanditssampledversionandverifyfigure2.19.Youneedtousetheholdfunctiontokeepbothplots.程序clc;closeall;clearall;fre_sin=input('FrequencyofsinusoidinHz=');fre_sample=input('SampligfrequencyinHz=');t=0:0.001:1;g=cos(2*pi*fre_sin*t);plot(t,g,'-')xlabel('時(shí)間t');ylabel('幅度')holdn=0:1:fre_sample;g_samle=cos(2*pi*fre_sin*n/fre_sample);plot(n/fre_sample,g_sample,'x');holdoff結(jié)果頻率10Hz;采樣頻率500Hz.M3.1題目Usingprogram3_1determineandplottherealandimaginarypartsandthemagnitudeandphasespectraofthefollowingDTFTforvariousvaluesofrandθ:Gejω=程序clc;closeall;clearall;%采樣頻率k=1000;r=input('r=');theda=input('theda=');%num多項(xiàng)式分子系數(shù)%den多項(xiàng)式分母系數(shù)num=[1,0,0];den=[1,-2*r*cos(theda),r^2];w=0:pi/k:pi;h=freqz(num,den,w);subplot(221)plot(w/pi,real(h));gridon;title('realpart')xlabel('\omega/\pi');ylabel('Amplitude')subplot(222)plot(w/pi,imag(h));gridon;title('imaginarypart')xlabel('\omega/\pi');ylabel('Amplitude')subplot(223)plot(w/pi,abs(h));gridon;title('magnitudespectrum')xlabel('\omega/\pi');ylabel('magnitude')subplot(224)plot(w/pi,angle(h));gridon;title('phasespectrum')xlabel('\omega/\pi');ylabel('phase,radians')結(jié)果r=0.8θ=π/6r=0.6θ=π/3M3.4題目UsingmatlabverifythefollowinggeneralpropertiesoftheDTFTaslistedinTable3.2:(a)Linearity,(b)time-shifting,(c)frequency-shifting,(d)differentiation-in-frequency,(e)convolution,(f)modulation,and(g)Parseval’srelation.Sincealldatainmatlabhavetobefinite-lengthvectors,thesequencestobeusedtoverifythepropertiesarethusrestrictedtobeoffinitelength.程序clc;clearall;closeall;N=input('Thelengthofthesequence=');k=0:N-1;%g為正弦信號(hào)g=2*sin(2*pi*k/(N/2));%h為余弦信號(hào)h=3*cos(2*pi*k/(N/2));[G,w]=freqz(g,1);[H,w]=freqz(h,1);%線性性質(zhì)alpha=0.5;beta=0.25;y=alpha*g+beta*h;[Y,w]=freqz(y,1);figure(1);subplot(211),plot(w/pi,abs(Y));xlabel('\omega/\pi');ylabel('|Y(e^j^\omega)|');title('線性疊加后的頻率特性');grid;%畫(huà)出Y的頻率特性subplot(212),plot(w/pi,alpha*abs(G)+beta*abs(H));xlabel('\omega/\pi');ylabel('\alpha|G(e^j^\omega)|+\beta|H(e^j^\omega)|');title('線性疊加前的頻率特性');grid;%畫(huà)出alpha*G+beta*H的頻率特性%時(shí)移性質(zhì)n0=10;%時(shí)移10個(gè)的單位y2=[zeros([1,n0])g];[Y2,w]=freqz(y2,1);G0=exp(-j*w*n0).*G;figure(2);subplot(211),plot(w/pi,abs(G0));xlabel('\omega/\pi');ylabel('|G0(e^j^\omega)|');title('G0的頻率特性');grid;%畫(huà)出G0的頻率特性subplot(212),plot(w/pi,abs(Y2));xlabel('\omega/\pi');ylabel('|Y2(e^j^\omega)|');title('Y2的頻率特性');grid;%畫(huà)出Y2的頻率特性%頻移特性w0=pi/2;%頻移pi/2r=256;%thevalueofw0intermsofnumberofsamplesk=0:N-1;y3=g.*exp(j*w0*k);[Y3,w]=freqz(y3,1);%對(duì)采樣的512個(gè)點(diǎn)分別進(jìn)行減少pi/2,從而生成G(exp(w-w0))k=0:511;w=-w0+pi*k/512;G1=freqz(g,1,w);figure(3);subplot(211),plot(w/pi,abs(Y3));xlabel('\omega/\pi');ylabel('|Y3(e^j^\omega)|');title('Y3的頻率特性');grid;%畫(huà)出Y3的頻率特性subplot(212),plot(w/pi,abs(G1));xlabel('\omega/\pi');ylabel('|G1(e^j^\omega)|');title('G1的頻率特性');grid;%畫(huà)出G1的頻率特性%頻域微分k=0:N-1;y4=k.*g;[Y4,w]=freqz(y4,1);%在頻域進(jìn)行微分y0=((-1).^k).*g;G2=[G(2:512)'sum(y0)]';delG=(G2-G)*512/pi;figure(4);subplot(211),plot(w/pi,abs(Y4));xlabel('\omega/\pi');ylabel('|Y4(e^j^\omega)|');title('Y4的頻率特性');grid;%畫(huà)出Y4的頻率特性subplot(212),plot(w/pi,abs(delG));xlabel('\omega/\pi');ylabel('|delG(e^j^\omega)|');title('delG的頻率特性');grid;%畫(huà)出delG的頻率特性%相乘性質(zhì)y5=conv(g,h);%時(shí)域卷積[Y5,w]=freqz(y5,1);figure(5);subplot(211),plot(w/pi,abs(Y5));xlabel('\omega/\pi');ylabel('|Y5(e^j^\omega)|');title('Y5的頻率特性');grid;%畫(huà)出Y5的頻率特性subplot(212),plot(w/pi,abs(G.*H));%頻域乘積xlabel('\omega/\pi');ylabel('|G.*H(e^j^\omega)|');title('G.*H的頻率特性');grid;%畫(huà)出G.*H的頻率特性%帕斯瓦爾定理y6=g.*h;%對(duì)于freqz函數(shù),在0到2pi直接取樣[Y6,w]=freqz(y6,1,512,'whole');[G0,w]=freqz(g,1,512,'whole');[H0,w]=freqz(h,1,512,'whole');H1=[fliplr(H0(1:129)')fliplr(H0(130:512)')]';val=1/(512)*sum(G0.*H1);val1=sum(g.*conj(h));val2=sum(G0.*conj(H0))/512;結(jié)果(a)(b)(c)(d)(e)M3.8題目UsingmatlabcomputetheN-pointDFTsofthelength-NsequencesofProblem3.12forN=3,5,7,and10.CompareyourresultswiththatobtainedbyevaluatingtheDTFTscomputedinProblem3.12atω=2pik/N,k=0,1,……N-1.程序clc;clearall;closeall;N=input('ThevalueofN=');k=-N:N;y1=ones([1,2*N+1]);w=0:2*pi/255:2*pi;Y1=freqz(y1,1,w);Y1dft=fft(y1);k=0:1:2*N;plot(w/pi,abs(Y1),k*2/(2*N+1),abs(Y1dft),'x');gridon;xlabel('Normalizedfrequency');ylabel('Amplitude');clc;clearall;closeall;N=input('ThevalueofN=');k=-N:N;y1=ones([1,2*N+1]);y2=y1-abs(k)/N;w=0:2*pi/255:2*pi;Y2=freqz(y2,1,w);%對(duì)y1做傅里葉變換Y2dft=fft(y2);k=0:1:2*N;plot(w/pi,abs(Y2),k*2/(2*N+1),abs(Y2dft),'x');gridon;xlabel('Normalizedfrequency');ylabel('Amplitude');clc;clearall;closeall;N=input('ThevalueofN=');k=-N:N;y3=cos(pi*k/(2*N));w=0:2*pi/255:2*pi;Y3=freqz(y3,1,w);Y3dft=fft(y3);k=0:1:2*N;plot(w/pi,abs(Y3),k*2/(2*N+1),abs(Y3dft),'x');gridon;xlabel('Normalizedfrequency');ylabel('Amplitude');結(jié)果N=3N=5N=7N=10N=3N=5N=7N=10N=3N=5N=7N=10M3.19題目UsingProgram3_10determinethez-t
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 個(gè)性化金融授信方案:2024專項(xiàng)借款合同
- 二零二五年度出納人員遠(yuǎn)程辦公聘用合同范本3篇
- 2025年度櫥柜安裝合同(含智能家居控制系統(tǒng)集成)3篇
- 2025年度門(mén)窗行業(yè)行業(yè)論壇與展覽組織合同3篇
- 2025版室內(nèi)外抹灰工程勞務(wù)分包施工合同范本4篇
- 二零二五年度戶外運(yùn)動(dòng)節(jié)攤位贊助及品牌推廣合同3篇
- 2025年度新能源充電樁設(shè)備質(zhì)押典當(dāng)租賃合同4篇
- 二零二五年度數(shù)據(jù)中心能耗EMC合同能源管理及優(yōu)化方案3篇
- 2025年度光伏扶貧項(xiàng)目個(gè)人工程承包合同模板
- MIL-100(Fe)及其復(fù)合材料可見(jiàn)光催化過(guò)硫酸鹽降解金橙Ⅱ研究
- 2024年大宗貿(mào)易合作共贏協(xié)議書(shū)模板
- 新聞?dòng)浾咦C600道考試題-附標(biāo)準(zhǔn)答案
- 變壓器搬遷施工方案
- 單位轉(zhuǎn)賬個(gè)人合同模板
- 八年級(jí)語(yǔ)文下冊(cè) 成語(yǔ)故事 第十五課 諱疾忌醫(yī) 第六課時(shí) 口語(yǔ)交際教案 新教版(漢語(yǔ))
- 中考語(yǔ)文二輪復(fù)習(xí):記敘文閱讀物象的作用(含練習(xí)題及答案)
- 2024年1月高考適應(yīng)性測(cè)試“九省聯(lián)考”數(shù)學(xué) 試題(學(xué)生版+解析版)
- (正式版)JBT 11270-2024 立體倉(cāng)庫(kù)組合式鋼結(jié)構(gòu)貨架技術(shù)規(guī)范
- EPC項(xiàng)目采購(gòu)階段質(zhì)量保證措施
- T-NAHIEM 101-2023 急診科建設(shè)與設(shè)備配置標(biāo)準(zhǔn)
- 針灸與按摩綜合療法
評(píng)論
0/150
提交評(píng)論