




已阅读5页,还剩13页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
数字信号处理(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 + 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(Type 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(PRESS 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. The 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. Determine 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 = ,num2str(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 = );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:% 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 frequency 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(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)M3.3 Using Program 3-1, determine and plot the real and imaginary 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 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 frequency 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(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)Figure aFigure bM3.4 Using MATLAB, verify the symmetry relations of the DTFT of a real sequence as listed 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(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 filter 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);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-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*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 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(Denfactors);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.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(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 from 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 Factors),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 order 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 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 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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 钢渣处理工专业知识考核试卷及答案
- 玻璃钢制品缠绕工抗压考核试卷及答案
- 智能家居装饰装修验收质量自评报告范文
- 重冶浸出工异常处理考核试卷及答案
- 美业员工激励培训课件
- 患者参与医疗技术更新流程
- 睡眠打鼾护理
- 手术室术中的护理
- 口腔常见手术护理配合
- 康复技术经验分享会
- 糖尿病病人饮食健康宣教
- 慢阻肺护理查房
- 儿童健康开学第一课-守护成长,从健康开始
- 支付宝迎新活动策划方案
- 在线教研室活动方案
- 安保日常培训课件
- DB11-T 695-2025 建筑工程资料管理规程
- 1《我三十万大军胜利南渡长江》跨学科公开课一等奖创新教案统编版语文八年级上册
- 工程概算、预算、结算审核报告模板
- 2025至2030年中国不锈钢氢退丝行业投资前景及策略咨询报告
- 《民营经济促进法》全文学习解读
评论
0/150
提交评论