已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 在线质检员培训效果评估报告
- 医院药剂科工作手册与操作规范
- 托班教师招聘面试备考策略
- 复杂系统运维挑战应对策略
- 护理专科护理信息化技术应用指南
- 2025福建宁德三都澳城澳建设发展公司招聘工作人员总和笔试历年参考题库附带答案详解
- 2025渤海银行北京分行社会招聘笔试历年参考题库附带答案详解
- 城市环境管理与城管单位面试考点解析
- 2025江西吉安市吉水县吉阳产业发展有限公司及下属子公司招聘已入闱投档分数线及安排笔试历年参考题库附带答案详解
- 培训师专员工作计划与员工发展方案
- 2025版房屋租赁合同下载
- 养老护理述职报告
- 肺癌的健康教育及出院指导
- DB42T 1279-2017 机动车检验检测机构资质认定评审通 用指南
- 地质灾害治理工程施工安全管理制度
- 2025至2030中国谐波滤波器行业产业运行态势及投资规划深度研究报告
- 教师如何践行教育家精神论文
- 脑梗合并肺部感染综合诊疗要点
- 自适应学习路径规划-洞察及研究
- 2025春季学期国开电大本科《管理英语4》一平台机考真题及答案(第二套)
- 土地托管服务管理制度
评论
0/150
提交评论