




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、數(shù)字信號處理(DSP)實驗報告 學 院 電子科學與工程學院 姓 名 學 號 指導教師 2016年6月2日實驗一M2.1 Write a MATLAB program to the generate the conjugate-symmetric and conjugate-antisymmetric parts of a finite length complex sequence. Using this program verify the results of Example 2.8.Code:x = 0 1+4j -2+3j 4-2j -5-6j -2j 3;cs = 0.5*(x +
2、conj(fliplr(x);ca = 0.5*(x - conj(fliplr(x);M2.2 (a) Using Program 2-2, generate the sequences shown in Figures 2.23 and 2.24. (b)Generate and plot the complex exponential sequence -2.7e(-0.4+j6)n for 0n82 using Program 2-2.Code:% Program 2_2% Generation of complex exponential sequence%a = input(Typ
3、e in real exponent = );b = input(Type in imaginary exponent = );c = a + b*i;K = input(Type in the gain constant = );N = input (Type in length of sequence = );n = 1:N;x = K*exp(c*n);%Generate the sequencestem(n,real(x);%Plot the real partxlabel(Time index n);ylabel(Amplitude);title(Real part);disp(PR
4、ESS RETURN for imaginary part);pausestem(n,imag(x);%Plot the imaginary partxlabel(Time index n);ylabel(Amplitude);title(Imaginary part);Figure 2.23Figure 2.24Figure 2.2bM2.4 (a) Write a MATLAB program to generate a sinusoidal sequence xn=Asin(w0n+f), and plot the sequence using the stem function. Th
5、e input data specified by the user the desired length L, amplitude A, the angular frequency w0, and the phase f where 0w0 and 0 2. Using this program, generate the sinusoidal sequences shown in Figure 2.22. (b) Generate sinusoidal sequences with the angular frequencies given in Problem 2.40. Determi
6、ne the period of each sequence from the plot, and verify the result theoretically.Code:L = input(Desired length = );A = input(Amplitude = );omega = input(Angular frequency = );phi = input(Phase = );n = 0:L-1;x = A*cos(omega*n + phi);stem(n,x);xlabel(Time Index); ylabel(Amplitude);title(omega_o = ,nu
7、m2str(omega/pi),pi);Figure 2.22M2.6 Write a MATLAB program to plot a continuous-time sinusoidal signal and its sampled version, and verify Figure 2.28. You need to the hold function to keep both plots.Code:t = 0:0.001:1;fo = input(Frequency of sinusoid in Hz = );FT = input(Sampling frequency in Hz =
8、 );g1 = cos(2*pi*fo*t);plot(t,g1,:);xlabel(time); ylabel(Amplitude); holdn = 0:1:FT;gs = cos(2*pi*fo*n/FT);plot(n/FT,gs,o); hold offM3.2 Using Program 3-1, determine and plot the real and imaginary parts and the magnitude and phase spectra of the DTFTs of the sequence of Problem 3.18 for N=10.,Code:
9、% Program 3_1% Discrete-Time Fourier Transform Computation% Read in the desired number of frequency samplesk = input(Number of frequency points = );% Read in the numerator and denominator coefficientsnum = input(Numerator coefficients = );den = input(Denominator coefficients = );% Compute the freque
10、ncy responsew = 0:pi/(k-1):pi;h = freqz(num, den, w);%h = h.*exp(1i*w*10);% Plot the frequency response%h=sin(21*w/2)./sin(w/2);%h=exp(-1i*w*5).*sin(w*11/2)./sin(w/2);subplot(2,2,1)plot(w/pi,real(h);gridtitle(Real part)xlabel(omega/pi); ylabel(Amplitude)subplot(2,2,2)plot(w/pi,imag(h);gridtitle(Imag
11、inary 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)M3.3 Using Program 3-1, determine and plot the real and imagi
12、nary parts and the magnitude and phase spectra of the following DTFTs:(a)X(ej)=0.1323(1+0.1444e-j-0.4519e-j2+0.1444e-j3+e-j4)1+0.1386e-j+0.8258e-j2+0.1393e-j3+0.4153e-j4 ,(b) X(ej)=0.3192(1+0.1885e-j-0.1885e-j2-e-j3)1+0.7856e-j+1.4654e-j2-0.2346e-j3 .Code: % Program 3_1% Discrete-Time Fourier Transf
13、orm Computation% Read in the desired number of frequency samplesk = input(Number of frequency points = );% Read in the numerator and denominator coefficientsnum = input(Numerator coefficients = );den = input(Denominator coefficients = );% Compute the frequency responsew = 0:pi/(k-1):pi;h = freqz(num
14、, den, w);%h = h.*exp(1i*w*10);% Plot the frequency response%h=sin(21*w/2)./sin(w/2);%h=exp(-1i*w*5).*sin(w*11/2)./sin(w/2);subplot(2,2,1)plot(w/pi,real(h);gridtitle(Real part)xlabel(omega/pi); ylabel(Amplitude)subplot(2,2,2)plot(w/pi,imag(h);gridtitle(Imaginary part)xlabel(omega/pi); ylabel(Amplitu
15、de)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)Figure aFigure bM3.4 Using MATLAB, verify the symmetry relations of the DTFT of a real sequence as liste
16、d in Table 3.1.Code:N = 8; % Number of samples in sequencegamma = 0.5; k = 0:N-1;x = 0.5.k;w = -3*pi:pi/1024:3*pi;X = freqz(x,1,w);subplot(2,2,1)plot(w/pi,real(X);gridtitle(Real part)xlabel(omega/pi); ylabel(Amplitude)subplot(2,2,2)plot(w/pi,imag(X);gridtitle(Imaginary part)xlabel(omega/pi); ylabel(
17、Amplitude)subplot(2,2,3)plot(w/pi,abs(X);gridtitle(Magnitude Spectrum)xlabel(omega/pi); ylabel(Magnitude)subplot(2,2,4)plot(w/pi,angle(X);gridtitle(Phase Spectrum)xlabel(omega/pi); ylabel(Phase, radians)M4.1 Using Program 4-1(new), investigate the effect of signal smoothing by a moving-average filte
18、r of length 5, 7 and 9. Does the signal smoothing improve with an increase in the length? What is the effect of the length on the delay between the smoothing output and the noisy input?Code:% Program 4_1% Signal Smoothing by a Moving-Average FilterR = 50;d = rand(R,1)-0.5;m = 0:1:R-1;s = 2*m.*(0.9.m
19、);x = s + d;plot(m,d,r-,m,s,b-,m,x,g:)xlabel(Time index n); ylabel(Amplitude)legend(dn,sn,xn);pauseM = input(Number of input samples = );b = ones(M,1)/M;y = filter(b,1,x);plot(m,s,r-,m,y,b-)legend(sn,yn);xlabel (Time index n);ylabel(Amplitude)實驗二M5.1 Using MATLAB, compute the N-point DFTs the length
20、-N sequences of Problem 3.18 for N=4,6,8 and 10. Compare your result with that obtained by evaluating the DTFTs computed in Problem 3.18 at =2kN,k=0,1.,N-1.Code:N = input(The value of N = );k = -N:N;y = ones(1,2*N+1);w = 0:2*pi/255:2*pi;Y = freqz(y, 1, w);Ydft = fft(y);n = 0:1:2*N;plot(w/pi,abs(Y),n
21、*2/(2*N+1),abs(Ydft),o);xlabel(omega/pi),ylabel(Amplitude);N=4N=8N=10N=6M6.1 Using Program 6-1, determine the factored form of the following z-transforms:(a)G1=3z4-2.4z3+15.36z2+3.84z+95z4-8.5z3+17.6z2+4.7z-6 ,(b)G2=2z4+0.2z3+6.4z2+4.6z+2.45z4+z3+6.6z2+0.42z+24 .Code:% Program 6_1% Determination of
22、the Factored Form% of a Rational z-Transform%num = input(Type in the numerator coefficients = );den = input(Type in the denominator coefficients = );K = num(1)/den(1);Numfactors = factorize(num);Denfactors = factorize(den);disp(Numerator factors);disp(Numfactors);disp(Denominator factors);disp(Denfa
23、ctors);disp(Gain constant);disp(K);zplane(num,den);Figure aFigure bM8.1 Using MATLAB, develop a cascade realization of each of the following linear-phase FIR transfer function:(a)H1(z)=-0.3+0.16z-1+0.1z-2+1.2z-3+0.1z-4+0.16z-5-0.3z-6 ,(b) H2(z)=2-3.8z-1+1.5z-2-4.2z-3+1.5z-4-3.8z-5+2z-6 ,(c) H3(z)=-0
24、.3+0.16z-1+0.1z-2-0.1z-4+0.16z-5-0.3z-6 ,(d) H4(z)=-2+3.8z-1-0.15z-2+0.15z-4-3.8z-5+2z-6 ,Code: num = input(Type in the numerator coefficients = );Numfactors = factorize(num);disp(Numerator factors);disp(Numfactors);Figure aFigure bFigure cFigure dM8.2 Consider the fourth-oder IIR transfer functionG
25、(z)=0.1103-0.4413z-1+0.6619z-2-0.4413z-3+0.1103z-41-0.1510z-1+0.8042z-2+0.1618z-3+0.1872z-4 .(a)Using MATLAB, express G(z) in factored form.(b)Develop two different cascade realizations of G(z).(c)Develop two different parallel form realization of G(z).Realize each second-order section in direct fro
26、m II.Code:% Program 8_2% Factorization of a Rational IIR Transfer Function%format shortnum = input(Numerator coefficients = );den = input(Denominator coefficients = );Numfactors = factorize(num);Denfactors = factorize(den);K = num(1)/den(1);disp(Numerator Factors),disp(Numfactors)disp(Denominator Fa
27、ctors),disp(Denfactors)disp(Gain constant);disp(K);Figure a實驗三M9.1 Design a digital Butterworth lowpass filter operating at a sampling rate of 100kHz with a 0.3dB cutoff frequency at 15kHz and a minimum stopband attenuation of 45 dB at 25 kHz using the bilinear transformation method. Determine the o
28、rder of the analog filter prototype using the formula given in Eq.(A.9), and then design the analog prototype filter using the M-file buttap of MATLAB. Transform the analog filter transform function to the desired digital transfer function using the M-file bilinear. Plot the gain and phase response
29、using MATLAB. Show all step used in the design.Code:wp=2*1/4;ws=2*15/40;n1,wn1=buttord(wp,ws,3,35);B,A=butter(n1,wn1);h1,w=freqz(B,A);f=w/pi*20000;plot(f,20*log10(abs(h1),r);axis(0,20000,-80,10);grid;xlabel(Frequency/Hz);ylabel(Magnitude/dB);實驗四M10.1 Plot the magnitude response of a linear-phase FIR
30、 highpass filter by truncating the impulse response hHPn of the ideal highpass filter of Eq.(10.17) to length N=2M+1 for two different values of M, and show that the truncated filter exhibits oscillatory behavior on both sides of the cutoff frequency.Code:M=800;n= -M:M;hn= -sin(0.4*pi*n)./(pi*n);%hn= -0.4*sinc(0.4*n);hn(M+1)=0.6;H,w = freqz(hn,1);plot(n,hn)figure,plot(
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 健康評估詳細解讀
- 初中家長課程教案課件
- 血液健康治療體系與臨床實踐
- 初中地理日本說課課件
- 交通設備制造業(yè)數(shù)字化轉(zhuǎn)型中的智能生產(chǎn)設備維護報告
- 四腦室膽脂瘤護理查房
- PROTAC-MTP3-degrade-1-生命科學試劑-MCE
- 保護大腦健康教育課件
- 新政策教育解讀
- 初中信息技術課件軟件
- 教師安全培訓內(nèi)容課件
- 2025年廣州市事業(yè)單位教師招聘考試生物學科專業(yè)知識試題
- 2025年養(yǎng)老護理員考試試卷及答案
- 2025年電梯檢驗員資格考試試卷-電梯轎廂與導軌維護試題
- 2025年宜賓市中考語文試題卷(含答案詳解)
- 幼兒小小運動會活動方案
- C語言程序設計說課課件
- 2023年對外漢語教育學引論知識點
- 對立違抗障礙行為矯正
- 福建省公路水運工程試驗檢測費用參考指標
- 抗生素降階梯療法
評論
0/150
提交評論