数字信号处理上机实验报告

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

数字信号处理上机实验报告

2018年5月21日

M 2.2

1.题目

The square wave and the sawtooth wave are two periodic sequences as sketched in figure ing the function stem. The input data specified by the user are: desired length L of the sequence, peak value A, and the period N. For the square wave sequence an additional user-specified parameter is the duty cycle, which is the percent of the period for which the signal is positive. Using this program generate the first 100 samples of each of the above sequences with a sampling rate of 20 kHz ,a peak value of 7, a period of 13 ,and a duty cycle of 60% for the square wave.

2.程序

clc ;

close all;

f = 20000;%采样频率

L = 100*(1/f);%采样个数

A = 7;%最大值

N = 13;%周期

t = 0:1/20000:L-1/20000;

%t=0:1:20;

y1 =(A * sawtooth(2*pi/N*f*t));

m =(A - max(y1))/2;

y2 = m+y1;

figure(1);

subplot(2,1,1);

stem (t,y2);

y3 = square(2*pi/13*20000*t,60);

subplot(2,1,2)

stem (t,y3);

3.结果

M 2.4

1.题目

(a)Write a matlab program to generate a sinusoidal sequence x[n]= Acos(ω0 n+Ф) and plot

the sequence using the stem function. The input data specified by the user are the desired length L, amplitude A, the angular frequency ω0 , and the phase Фwhere 0<ω0

(b)Generate sinusoidal sequences with the angular frequencies given in Problem 2.22.

Determine the period of each sequence from the plot and verify the result theoretically.

2.程序

clc;clear all;close all;

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('n');ylabel('幅度');

title(['\omega_{o} = ',num2str(omega)]);

3.结果

(a)

ω0=0

ω0=0.1π

ω0=0.8π

ω0=1.2π

(b)

ω0=0.14π

ω0=0.24π

ω0=0.34π

ω0=0.68π

ω0=0.75π

M 2.5

1.题目

Generate the sequences of problem 2.21(b) to 2.21(e) using matlab.

2.程序

(b)

n = 0 : 99;

x=sin(0.6*pi*n+0.6*pi);

stem(n,x);

xlabel('n');ylabel('幅度');

(c)

n = 0 : 99;

x=2*cos(1.1*pi*n-0.5*pi)+2*sin(0.7*pi*n);

stem(n,x);

xlabel('n');ylabel('幅度');

(d)

n = 0 : 99;

x=3*sin(1.3*pi*n-4*cos(0.3*pi*n+0.45*pi));

stem(n,x);

xlabel('n');ylabel('幅度');

(e)

n = 0 : 99;

x=5*sin(1.2*pi*n+0.65*pi)+4*sin(0.8*pi*n)-cos(0.8*pi*n);

stem(n,x);

xlabel('n');ylabel('幅度');

(f)

n = 0 : 99;

x=mod(n,6);

stem(n,x);

xlabel('n');ylabel('幅度');

3.结果

(b)

相关文档
最新文档