DSP數(shù)字信號處理MATLAB作業(yè)_第1頁
DSP數(shù)字信號處理MATLAB作業(yè)_第2頁
DSP數(shù)字信號處理MATLAB作業(yè)_第3頁
DSP數(shù)字信號處理MATLAB作業(yè)_第4頁
DSP數(shù)字信號處理MATLAB作業(yè)_第5頁
已閱讀5頁,還剩11頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、matlab 作業(yè) 姓名:唐建秋 學(xué)號:2902102017 指導(dǎo)老師:朱學(xué)勇m2.2(b) n=1:1:20; stem(n,sin(0.8*pi*n+0.8*pi);xlabel(n);ylabel(amplitude) (c) n=1:1:40; y= real(exp(i*pi*n/5)+ imag(exp(i*pi*n/10); stem(n,y);xlabel(n);ylabel(amplitude) (d) n=1:1:40; x = 5*cos(1.5*pi*n+0.75*pi)+4*cos(0.6*pi*n)-sin(0.5*pi*n); stem(n,x); xlabel(

2、n);ylabel(amplitude) (e) n=1:1:80; x = 5*cos(1.5*pi*n+0.75*pi)+4*cos(0.6*pi*n)-sin(0.5*pi*n); stem(n,x); xlabel(n);ylabel(amplitude) m2.7alpha = input(alpha = ); y0 = -1; y1 = 0.5*(y0 + (alpha/y0); while abs(y1-y0)0.00001 y2 = 0.5*(y1+(alpha/y1); y0 = y1; y1 = y2; end disp(squre root of alpha is); d

3、isp(y1); alpha = 2squre root of alpha is -1.4142 m2.9 x n =4,5,1,2,3,0,2, -3=n=3; y n =6,3,1,0,8,7,2 ,-1=n=5 w n = 3,2,2,1,0,2,5, 2=n=8 ww = 4,5,1,2,3,0,2 c_ww,lags = xcorr(ww,10,coeff); stem(lags,c_ww) r xx n =8,10,14,11,23,11,59,11,23,11,14,10,8,-6=n=6 r yy n =12,48,29,31,30,27,163,27,30,31,29,48,

4、12,-6=n=6 r ww n =15,4,6,12,6,2,47,2,6,12,6,10,15, -6=n=6 m3.1 k = input(number of frequency points = );num = input(numerator coefficients = );den = input(denominator coefficients = );w = 0:pi/(k-1):pi;h = freqz(num, den, w);subplot(2,2,1)plot(w/pi,real(h);gridtitle(real part)xlabel(omega/pi); ylabe

5、l(amplitude)subplot(2,2,2)plot(w/pi,imag(h);gridtitle(imaginary part)xlabel(omega/pi); ylabel(amplitude)subplot(2,2,3)plot(w/pi,abs(h);gridtitle(magnitude spectrum)xlabel(omega/pi); ylabel(magnitude)subplot(2,2,4)plot(w/pi,angle(h);gridtitle(phase spectrum)xlabel(omega/pi); ylabel(phase, radians) r=

6、0.1; =0 r=0.5; =0 m3.7syms w;h_a=1+0.4*exp(-i*w);g_a=i*diff(h_a);grde_a=real(g_a/h_a)syms w;h_b=1/(1+0.6*exp(-i*w);g_b=i*diff(h_b);grde_b=real(g_b/h_b)grde_a =exp(i*conj(w)/(5*(2*exp(i*conj(w)/5 + 1) + 1/(5*exp(i*w)*(2/(5*exp(i*w) + 1)grde_b = - (3*exp(i*conj(w)/(10*(3*exp(i*conj(w)/5 + 1) - 3/(10*e

7、xp(i*w)*(3/(5*exp(i*w) + 1)m4.1z,p,k = buttap(4); pz, pp = zp2tf(z, p, k); omega = 0: 0.01: 5; h = freqs(pz,pp,omega); plot (omega,20*log10(abs(h);grid xlabel(normalized frequency); ylabel(gain, db);m4.7n,wn=cheb1ord(0.3157894,1,0.5,30,s);b,a=cheby1(n,0.5,wn,s);num,den=lp2bs(b,a,2*pi*sqrt(700)*106,2

8、*pi*15e6);omega_1=0:0.01:10;h_1=freqs(b,a,omega_1);gain_1=20*log10(abs(h_1);plot(omega_1,gain_1);grid;axis(0 4 -70 5);xlabel(omega);ylabel(gain,db);title(analog lowpass filter);omega_2=0:10000:160e6*pi;h_2=freqs(b,a,omega_2);gain_2=20*log10(abs(h_2);plot(omega_2,gain_2);grid;axis(0 4 -70 5);xlabel(o

9、mega);ylabel(gain,db);title(analog bandpass filter);幅度圖 m5.2g=input(第一個序列=);h=input(第二個序列=);n=input(n=);m=1:1:n;y=zeros(1,n);for k=1:n for m=1:n n=mod(1+k-m),n); if n=0 n=n; end s=s+g(m)*h(n); end y(k)=s; s=0;endy(a) 第一個序列=5 -2 2 0 4 3第二個序列=3 1 -2 2 -4 4y=-69-1620-445(b)第一個序列= 2 j -1 j*3 4-j*3 1+j*2

10、 3+j*2;第二個序列= -3 2+j*4 -1+j*4 4+j*2 -3+j;y=columns 1 through 3 11.0000 +25.0000i -9.0000 +48.0000i 3.0000 +17.0000i columns 4 through 5 29.0000 + 0.0000i -10.0000 +12.0000i(c)第一個序列=1 cos(pi/5) cos(pi*0.4) cos(pi*0.6) cos(pi*0.8) ;第二個序列=1 3 9 27 81;y=-23.0000 -69.0000 35.0000 105.0000 73.0000m5.8x =

11、11 8-i*2 1-i*12 6+i*3 -3+i*2 2+i 15; k = 8:12; xf(k)=conj(x(mod(-k+2,12); xf = x xf(8:12); x = ifft(xf); n = 0:11; y = exp(i*2*pi*n/3).*x; output = x(1) x(7) sum(x) sum(y); disp(output) disp(x.*x)4.5000 -0.8333 11.0000 -3.0000-2.0000i 74.8333m5.9n=0:255; x = 0.1*n.*exp(-0.03*n); plot(n,x);axis(0 255

12、 0 1.3); xlabel(n);ylabel(amplitude); title(original signal); pause z = zeros(1,50) ones(1,156) zeros(1,50); y = 4*rand(1,256)-1; yf = z.*fft(y); yinv = ifft(yf); s = x + yinv; plot(n,s);axis(0 255 -2 4); xlabel(n);ylabel(amplitude); title(noise corrupted signal); pause zc = ones(1,50) zeros(1,156)

13、ones(1,50); sf = zc.*fft(s); xr = ifft(sf); plot(n,xr);axis(0 255 0 1.3); xlabel(n);ylabel(amplitude); title(signal after fourier-domain filtering); m6.1(a)num=input(分子系數(shù)=);den=input(分母系數(shù)=);z,p,k=tf2zp(num,den);m=abs(p);disp(零點(diǎn)在);disp(z);disp(極點(diǎn)在);disp(p);disp(增益常數(shù));disp(k);disp(極點(diǎn)半徑);disp(m);sos=zp

14、2sos(z,p,k);disp(二階部分);disp(real(sos);zplane(num,den)分子系數(shù)=2 -5 13.48 -7.78 9分母系數(shù)=4 7.2 20 -0.8 8零點(diǎn)在 1.050000000000001 + 1.974208702239964i 1.050000000000001 - 1.974208702239964i 0.200000000000000 + 0.927361849549570i 0.200000000000000 - 0.927361849549570i極點(diǎn)在 -1.000000000000000 + 1.999999999999999i -

15、1.000000000000000 - 1.999999999999999i 0.100000000000000 + 0.624499799839840i 0.100000000000000 - 0.624499799839840i增益常數(shù) 0.500000000000000極點(diǎn)半徑 2.236067977499789 2.236067977499789 0.632455532033676 0.632455532033676二階部分 columns 1 through 4 0.500000000000000 -1.050000000000001 2.500000000000001 1.0000

16、00000000000 1.000000000000000 -0.399999999999999 0.900000000000000 1.000000000000000 columns 5 through 6 2.000000000000000 4.999999999999996 -0.200000000000000 0.400000000000001(b)分子系數(shù)=5 3.5 21.5 -4.6 18輸入分母系數(shù)=5 15.5 31.7 22.52 4.8零點(diǎn)在 -0.600000000000000 + 1.907878402833891i -0.600000000000000 - 1.90

17、7878402833891i 0.250000000000000 + 0.915150260886156i 0.250000000000000 - 0.915150260886156i極點(diǎn)在 -1.050000000000001 + 1.702204453054923i -1.050000000000001 - 1.702204453054923i -0.599999999999999 -0.400000000000001 增益常數(shù) 1極點(diǎn)半徑 2.000000000000003 2.000000000000003 0.599999999999999 0.400000000000001二階部分

18、 columns 1 through 4 1.000000000000000 -0.500000000000000 0.900000000000000 1.000000000000000 1.000000000000000 1.200000000000000 3.999999999999999 1.000000000000000 columns 5 through 6 1.000000000000000 0.240000000000000 2.100000000000002 4.000000000000011m6.3r = input(type in the residues = );p =

19、input(type in the poles = );k = input(type in the constants = );num, den = residuez(r,p,k);disp(numerator polynomial coefficients); disp(num)disp(denominator polynomial coefficients); disp(den)(a)type in the residues = -4/5 -7/6type in the poles = -1/5 -1/6type in the constants = 3numerator polynomi

20、al coefficients 1.0333 0.7333 0.1000denominator polynomial coefficients 1.0000 0.3667 0.0333(b)numerator polynomial coefficients -0.9000 -2.5600 -0.1000 -0.6000denominator polynomial coefficients1.0000 0.4000 0.6000 0.2400(c)numerator polynomial coefficients 6.2500 6.5500 1.7300 0denominator polynom

21、ial coefficients1.0000 1.6400 0.8900 0.1600(d)numerator polynomial coefficients -4.5000 -6.8750 -3.6375 -0.8438denominator polynomial coefficients1.0000 1.5000 0.7875 0.1688m7.1b=3.8461 -6.3487 3.8461;z1=0 0;n=0:49;x1=cos(0.3*n);x2=cos(0.6*n);y=filter(b,1,x1+x2,z1);plot(y);plot(x1);plot(x2);m7.5syms

22、(x,real);h=x*(1-x)*(1-0.2743*x+x*x)/(1+0.1532*x+0.8351*x*x)*(1+0.487*x+0.84*x*x);h=simple(h);w=0:2*pi/256:2*pi;y=subs(h,exp(-j*w);subplot(2,1,1)plot(w/pi,abs(y)subplot(2,1,2)plot(w/pi,unwrap(angle(y)sos1=1 -1 0 1 0.2695 0;1 -0.2743 1 1 0.4109 0.6758;g=0.203; b,a=sos2tf(sos1,g)b = 0.2030 -0.2587 0.25

23、87 -0.2030a = 1.0000 0.6804 0.7865 0.1821m8.1num=input(系數(shù)向量=);den=1;sos,g=tf2sos(num,den);disp(gain is:);disp(g);sos(a)系數(shù)向量=-0.24 0.184 0.448 1.296 0.4448 0.184 -0.24gain is: -0.2400sos = 1.0000 -2.9024 1.0008 1.0000 0 0 1.0000 1.3369 1.6623 1.0000 0 0 1.0000 0.7989 0.6011 1.0000 0 0(b)系數(shù)向量=4 -13.6

24、-25.08 77.2 -25.08 -13.6 4gain is: 4sos = 1.0000 -1.3508 -9.6270 1.0000 0 0 1.0000 -2.1895 1.0000 1.0000 0 0 1.0000 0.1403 -0.1039 1.0000 0 0(c)系數(shù)向量=-0.24 0.184 0.4448 -0.4448 -0.184 0.24gain is: -0.2400sos = 1.0000 1.1631 0 1.0000 0 0 1.0000 -0.1402 -0.8598 1.0000 0 0 1.0000 -1.7895 1.0000 1.0000 0

25、 0(d)系數(shù)向量=4 -13.6 -25.08 25.08 13.6 -4gain is: 4sos = 1.0000 -4.4555 0 1.0000 0 0 1.0000 0.6873 -1.6873 1.0000 0 0 1.0000 0.3682 -0.1330 1.0000 0 0m8.2num=input(分子系數(shù)=);den=input(分母系數(shù)=);disp(a)r1,p1,k1=residuez(num,den);disp(留數(shù));disp(r1)disp(極點(diǎn));disp(p1)disp(常數(shù));disp(k1)disp(b)z2,p2,k2=tf2zp(num,den)

26、;sos=zp2sos(z2,p2,k2);disp(二階部分=);disp(sos)disp(c)r3,p3,k3=residuez(num,den);r4,p4,k4=residue(num,den);disp(并聯(lián)i型)disp(留數(shù));disp(r3)disp(極點(diǎn));disp(p3)disp(常數(shù));disp(k3)disp(并聯(lián)ii型)disp(留數(shù));disp(r4)disp(極點(diǎn));disp(p4)disp(常數(shù));disp(k4)分子系數(shù)=0.3901 0.6426 0.8721 0.6426 0.3901分母系數(shù)=1 0.5038 0.8923 0.3844 0.1569(

27、a)留數(shù) columns 1 through 3 -0.1740 - 0.0727i -0.1740 + 0.0727i -0.8741 + 0.1120i column 4 -0.8741 - 0.1120i極點(diǎn) columns 1 through 3 0.0307 - 0.8386i 0.0307 + 0.8386i -0.2826 - 0.3780i column 4 -0.2826 + 0.3780i常數(shù) 2.4863(b二階部分= 0.3901 0.5809 0.3901 1.0000 0.5653 0.2228 1.0000 0.1582 1.0000 1.0000 -0.0615 0.7043(c)并聯(lián)i型留數(shù) -0.1740 + 0.0727i -0.1740 - 0.0727i -0.8741 - 0.1120i -0.8741 + 0.1120i極點(diǎn) 0.0307 + 0.8386i 0.0307 - 0.8386i -0.

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論