当前位置:文档之家› _数字信号处理实验一.

_数字信号处理实验一.

姓名:罗格学号:2012302530084 班级:信安3班日期:2014.3.15实验1基本离散信号的MATLAB产生和图形显示实验前言:MATLAB 是一套功能强大的工程计算及数据处理软件,在众多领域得到广泛应用。

它是一种面向对象的,交互式程序设计语言,其结构完整有优良的可移植性。

它在矩阵运算,数字信号处理方面有强大的功能。

另外,MATLAB提供了方便的绘图功能,便于用户直观地输出处理结果。

本课程实验要求学生运用MATLAB编程完成一些数字信号处理的基本功能,加深对教学内容的理解。

实验目的:1.熟悉掌握MATLAB的基本操作2.通过使用来熟悉常用离散信号;实验内容:1.1 G ENERATION OF SEQUENCESProject 1.1 Unit sample and unit step sequencesA copy of Program P1_1 is given below.% Program P1_1% Generation of a Unit Sample Sequenceclf;% Generate a vector from -10 to 20n = -10:20;% Generate the unit sample sequenceu = [zeros(1,10) 1 zeros(1,20)];% Plot the unit sample sequencestem(n,u);xlabel('Time index n');ylabel('Amplitude');title('Unit Sample Sequence');axis([-10 20 0 1.2]);< Insert program code here. Copy from m-file(s) and paste. >Answers:Q1.1The unit sample sequence u[n] generated by running Program P1_1 is shown below:< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >Q1.2The purpose of clf command is–清除当前窗口图形The purpose of axis command is–设定坐标轴最大值最小值和The purpose of title command is –命名图表名 The purpose of xlabel command is –命名X 轴 The purpose of ylabel command is –命名Y 轴Q1.3The modified Program P1_1 to generate a delayed unit sample sequence ud[n] with a delay of 11 samples is given below along with the sequence generated by running this program . < clf; n=0:30;u=[zeros(1,11) 1 zeros(1,19)]; stem(n,u);xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([0 30 0 1.2]);> <Time index nA m p l i t u d eUnit Sample Sequence>Q1.4The modified Program P1_1 to generate a unit step sequence s[n] is given below along with the sequence generated by running this program .<% Program s_P1_1% Generation of a Unit Step Sequence clf; % Generate a vector from -10 to 20 n = -10:20;% Generate the unit sample sequence s = [zeros(1,10) ones(1,21)]; % Plot the unit sample sequence stem(n,s);xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]); ><Time index nA m p l i t u d eUnit Sample Sequence>Q1.5The modified Program P1_1 to generate a unit step sequence sd[n] with an advance of 7 samples is given below along with the sequence generated by running this program .<% Program s_P1_1% Generation of a Unit Step Sequence clf;% Generate a vector from -10 to 20 n = -10:20;% Generate the unit sample sequence s = [zeros(1,3) ones(1,28)];% Plot the unit sample sequence stem(n,s);xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]); >Time index nA m p l i t u d eUnit Sample Sequence>Project 1.2 Exponential signalsA copy of Programs P1_2 and P1_3 are given below . < clf;c = -(1/12)+(pi/6)*i; K = 2; n = 0:40;x = K*exp(c*n); subplot(2,1,1); stem(n,real(x));xlabel('Time index n');ylabel('Amplitude'); title('Real part'); subplot(2,1,2); stem(n,imag(x));xlabel('Time index n');ylabel('Amplitude'); title('Imaginary part');> Answers: Q1.6The complex-valued exponential sequence generated by running Program P1_2 is shown below :0510152025303540Time index n A m p l i t u d eReal part0510152025303540Time index nA m p l i t u d eImaginary part>Q1.7 The parameter controlling the rate of growth or decay of this sequence is - C The parameter controlling the amplitude of this sequence is - KQ1.8 The result of changing the parameter c to (1/12)+(pi/6)*i is -实部取反 Q1.9 The purpose of the operator real is -合成实部 The purpose of the operator imag is -合成虚部 Q1.10 The purpose of the command subplot is -创建坐标Q1.11The real-valued exponential sequence generated by running Program P1_3 is shown below :<Time index n A m p l i t u d eTime index nA m p l i t u d eImaginary part>Q1.12 The parameter controlling the rate of growth or decay of this sequence is - a The parameter controlling the amplitude of this sequence is - nQ1.13 The difference between the arithmetic operators ^ and .^ is - ^用于矩阵 .^用于数组 Q1.14The sequence generated by running Program P1_3 with the parameter a changed to 0.9 and the parameter K changed to 20 is shown below : <>Q1.15 The length of this sequence is - 36It is controlled by the following MATLAB command line :n=0:35It can be changed to generate sequences with different lengths as follows (give an example command line and the corresponding length): n=0::2;length :20Q1.16The energies of the real-valued exponential sequences x [n]generated in Q1.11 and Q1.14 and computed using the command sum are 3.1851e+003,195.4943Project 1.3 Sinusoidal sequences A copy of Program P1_4 is given below . < n = 0:40;f = 0.1; phase = 0; A = 1.5;arg = 2*pi*f*n - phase; x = A*cos(arg); clf; stem(n,x);axis([0 40 -2 2]); grid;title('Sinusoidal Sequence'); xlabel('Time index n'); ylabel('Amplitude'); axis; > Answers:Q1.17 The sinusoidal sequence generated by running Program P1_4 is displayed below .<Sinusoidal SequenceTime index nA m p l i t u d e>Q1.18 The frequency of this sequence is - f=0.1HzIt is controlled by the following MATLAB command line :A sequence with new frequency such as 1000Hz can be generated by the following command line :The parameter controlling the phase of this sequence is - phase The parameter controlling the amplitude of this sequence is - A The period of this sequence is - -10sQ1.19 The length of this sequence is -序列的长度是:41It is controlled by the following MATLAB command line : n=0:40A sequence with new length __31___ can be generated by the following command line :Q1.20 The average power of the generated sinusoidal sequence is -Q1.21 The purpose of axis command is - 1.5000The purpose of grid command is -控制坐标轴缩放比例 Q1.22The modified Program P1_4 to generate a sinusoidal sequence of frequency 0.9 is given below along with the sequence generated by running it .<% Generation of a sinusoidal sequence n = 0:40; f = 0.9; phase = 0; A = 1.5;arg = 2*pi*f*n - phase; x = A*cos(arg);clf; % Clear old graphstem(n,x); % Plot the generated sequence axis([0 40 -2 2]); grid;title('Sinusoidal Sequence'); xlabel('Time index n'); ylabel('Amplitude'); axis; ><0510152025303540Sinusoidal SequenceTime index nA m p l i t u d e>A comparison of this new sequence with the one generated in Question Q1.17 shows - 两幅图形相同 (频率为0.1和频率为0.9的两个正弦序列的图形相同)A sinusoidal sequence of frequency 1.1 generated by modifying Program P1_4 is shown below. <0510152025303540Sinusoidal SequenceTime index nA m p l i t u d e>A comparison of this new sequence with the one generated in Question Q1.17 shows –波形相同 Q1.23The sinusoidal sequence of length 50, frequency 0.08, amplitude 2.5, and phase shift of 90 degrees generated by modifying Program P1_4 is displayed below .<Sinusoidal SequenceTime index nA m p l i t u d e>The period of this sequence is – 2π/ω=1/f=1/0.08=25/2周期为25/2所以在25以内有2个余弦波形Q1.24By replacing the stem command in Program P1_4 with the plot command, the plot obtained is as shown below :<-2-1.5-1-0.50.511.52Sinusoidal SequenceTime index nA m p l i t u d e>The difference between the new plot and the one generated in Question Q1.17 is –1.17中是离散的点,而PLOT 命令将离散的点用平滑的曲线连接起来,使之成为连续的余弦信号。

相关主题