东南大学matlab作业3

上传人:F****n 文档编号:102345279 上传时间:2019-10-02 格式:DOC 页数:20 大小:1,004KB
返回 下载 相关 举报
东南大学matlab作业3_第1页
第1页 / 共20页
东南大学matlab作业3_第2页
第2页 / 共20页
东南大学matlab作业3_第3页
第3页 / 共20页
东南大学matlab作业3_第4页
第4页 / 共20页
东南大学matlab作业3_第5页
第5页 / 共20页
点击查看更多>>
资源描述

《东南大学matlab作业3》由会员分享,可在线阅读,更多相关《东南大学matlab作业3(20页珍藏版)》请在金锄头文库上搜索。

1、Matlab Worksheet 3 Part A 1. Using function conv_m.m to make convolution between the following to functions (x and h): x=3, 11, 7, 0, -1, 7, -5, 0, 2; h=11, 9, 0, -7, -3, 2, 0 -1; nx=-2:6; nh=0:7; Plot the functions and convolution results. Answer: home_work_3_A_1.m x=3, 11, 7, 0, -1, 7, -5, 0, 2; h

2、=11, 9, 0, -7, -3, 2, 0 -1; nx=-2:6; nh=0:7; y, ny=conv_m(x,nx,h,nh); subplot(3,1,1); stem(nx,x); ylabel(xn); axis(-6 10 -20 20); subplot(3,1,2); stem(nh,h); ylabel(hn); axis(-6 10 -20 20); subplot(3,1,3); stem(ny,y); xlabel(n); ylabel(yn); axis(-6 10 -50 50); conv_m.m function y, ny=conv_m(x,nx,h,n

3、h) %convolution function %conv_m.m nyb=nx(1)+nh(1); nye=nx(length(x)+nh(length(h); ny=nyb:nye; y=conv(x,h); end -6-4-20246810 -20 0 20 xn -6-4-20246810 -20 0 20 hn -6-4-20246810 -50 0 50 n yn 2 2. Plot the frequency response over for the following transfer function by letting 0 , where is the freque

4、ncy (rad/sample)., with appropriate labels and title. j ez . 9 . 06 . 1 )( 2 zz z zH Answer: home_work_3_A_2.m delta=0.01; Omega=0:delta:pi; z=exp(j .* Omega); H= z ./ (z.2+1.6*z+0.9); subplot(2,1,1); plot(Omega, abs(H),m,LineWidth,2); xlabel(0Omegapi); ylabel(|H(Omega)|); axis(0 pi 0 max(abs(H); su

5、bplot(2,1,2); plot(Omega,atan2(imag(H),real(H),k,LineWidth,2); xlabel(0Omegapi); ylabel( -pi Phi_H pi) title( frequency response); axis(0 pi -pi pi); 00.511.522.53 0 5 10 15 0 |H()| 00.511.522.53 -2 0 2 0 - H frequency response 3. Use fft to analyse following signal by plotting the original signal a

6、nd its spectrum. . 1024 4672sin 1024 1372sin 1024 322sin nnn nx 3 Answer: home_work_3_A_3.m %Examine signal components %sampling rate 1024Hz N=1024; dt=1/N; t=0:dt:1-dt; %*define the signal* x= sin(2*pi*32 .*t) +sin(2*pi*137 .*t )+ sin(2*pi* 467 .*t ) ; %* subplot(2,1,1); plot(t,x); axis(0 1 -1 1);

7、xlabel(nT (seconds); ylabel(xn); X=fft(x); df=1; f=0:df:N-1; subplot(2,1,2); plot(f,abs(X); axis(0 N/2 0 120); xlabel(k (Hz); ylabel(|Xk|); 00.10.20.30.40.50.60.70.80.91 -1 -0.5 0 0.5 1 nT (seconds) xn 050100150200250300350400450500 0 50 100 k (Hz) |Xk| 4. Use the fast Fourier transform function fft

8、 to analyse following signal. Plot the original signal, and the magnitude of its spectrum linearly and logarithmically. Apply Hamming window to reduce the leakage. . 1024 7 .4672sin 1024 4 . 1372sin 1024 5 .322sin nnn nx The hamming window can be coded in Matlab as for n=1:N hamming(n)=0.54+0.46*cos

9、(2*n-N+1)*pi/N); end; 4 where N is the data length in the FFT. Answer: home_work_3_A_4.m %Windowing for reducing leakage %sampling rate 1024Hz N=1024; dt=1/N; t=0:dt:1-dt; %*define the signal* x= sin(2*pi*32.5.*t )+. sin(2*pi*137.4 .*t )+. sin(2*pi*467.7.*t ); %* % Apply rectangular window subplot(3

10、,2,1); plot(t,x); axis(0 1 -5 5); xlabel(nT (seconds); ylabel(xn rectang win); X=fft(x); df=1; f=0:df:N-1; subplot(3,2,2); plot(f,20*log10(abs(X); axis(0 N/2 -30 60); xlabel(k (Hz); ylabel(|Xk| (db); % Apply triangular window for n=1:N w(n)=1-abs(2*n-N+1)/N; end; x1=x .*w; subplot(3,2,3); plot(t,x1)

11、; axis(0 1 -5 5); xlabel(nT (seconds); ylabel(xn triang win); X=fft(x1); df=1; f=0:df:N-1; subplot(3,2,4); plot(f,20*log10(abs(X); axis(0 N/2 -30 60); xlabel(k (Hz); ylabel(|Xk| (db); % Apply Hamming window for n=1:N w(n)=0.54+0.46*cos(2*n-N+1)*pi/N); end; x1=x .*w; subplot(3,2,5); plot(t,x1); axis(

12、0 1 -5 5); xlabel(nT (seconds); ylabel(xn Hamming win); X=fft(x1); df=1; f=0:df:N-1; subplot(3,2,6); plot(f,20*log10(abs(X); 5 axis(0 N/2 -30 60); xlabel(k (Hz); ylabel(|Xk| (db); 00.51 -5 0 5 nT (seconds) xn rectang win 0200400 -20 0 20 40 60 k (Hz) |Xk| (db) 00.51 -5 0 5 nT (seconds) xn triang win

13、 0200400 -20 0 20 40 60 k (Hz) |Xk| (db) 00.51 -5 0 5 nT (seconds) xn Hamming win 0200400 -20 0 20 40 60 k (Hz) |Xk| (db) 6 Part B Simulation Using SIMULINK INTRODUCTION The objective of this laboratory is to learn about various properties of signals and systems by doing simulations in SIMULINK. PAR

14、T 1. BASICS OF SIMULINK 1.1 UNDERSTANDING SIMPLE WAVEFORMS AND INTEGRATION Create a pulse of height 2 units from time 0 to 4 seconds by subtracting two unit steps and adding a gain. Connect this pulse to an integrator with a gain of 0.5 and a zero initial condition. Connect oscilloscopes to show the

15、 pulse and the output of the integrator. You may wish to name your simulation (block) diagram; to do so use the save as feature under edit. Your block diagram should be similar as below. u Before simulating you need to pull down the simulation header and double click on parameters. Unless told otherwise always assume that you can use the ode 45 integration algorithm shown in this window and the other default par

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 教学/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号