Digital signal processing experiment one T3

Digital signal processing experiment one T3

Subject requirements

A continuous periodic square wave signal frequency is 200Hz, the signal amplitude between -1 + 1V, which is required to display the graphics window on two periodic waveforms. At 4kHz frequency sampling the continuous signal, generating a programming signal and a discrete signal which is a continuous waveform obtained by sampling.

principle

Digital signal processing ppt chapter 1Insert picture description here

Insert picture description here
Insert picture description here
The point is that the formula
w 0 = 2 π TT 0 w_{0}=2\pi \frac{T}{T_{0}}w0=2 πT0T
I.e., a period of continuous signal and a sampling signal period obtained digital frequency .
In this question, the continuous signal period T 0 = 1 200 s T_{0}=\frac{1}{200}sT0=2001s , sampling signal periodT = 1 4000 s T=\frac{1}{4000}sT=40001s .
Thus,w 0 = 2 π TT 0 = π 10 rad w_{0}=2\pi \frac{T}{T_{0}}=\frac{\pi }{10}radw0=2 πT0T=10Fr.r a d
We will sample in one periodN = 2 π w 0 = 20 N=\frac{2\pi }{w_{0}}=20N=w02 p=2 0 points.

Implementation

The usage of the square function
f=square(a*t)
generates a period T= 2 π a \frac{2\pi }{a}a2 pThe square wave function of
this problem is to generate T = 1 200 s T=\frac{1}{200}sT=2001The square wave signal of s ,
soa = 400 π a=400\pia=4 0 0 π

Code

clear all
clc

%生成1~1/100间隔为1/4000的向量
t = 0:1/4000:0.01;
%通过square产生一个方波序列
f1 = square(400*pi*t);
%绘制图形,放在子图1
subplot(2,1,1);
%绘制离散图
stem(t, f1);
%绘制图形,放在子图2
subplot(2,1,2);
%绘制连续图
plot(t,f1);
%定义XY轴长度
axis([0,0.01,-1.5,1.5]);

Guess you like

Origin blog.csdn.net/weixin_43982216/article/details/109432949