📄 experiment_1_1.m
字号:
%==========================================================================
% Name:experiment_1_1.m for Digital Signal Processing
%==========================================================================
clear;close all,
p=0.0005;t1=0.5;
t=0:p:t1;
A=444.128;
a=50*1.414*pi;
omiga=1.414*50*pi;
xa=A*exp(-a*t).*sin(omiga*t).*u(t);
fs=input('Please type in the sample frequency fs=:');
T=1/fs;
L=t1/T;
n=0:L;
xn=A*exp(-a*n*T).*sin(omiga*n*T).*u(n*T);
%==========================================================================
W1=2*pi*fs;
N=512;
k=-N:N;
W=k*W1/N;
Xa=xa*exp(-j*t'*W)*p;
Xa1=abs(Xa);
phi=57.3*angle(Xa);
%==========================================================================
w1=2*pi;
N=512;
k=-N:N;
w=k*w1/N;
Xn=xn*exp(-j*(n)'*w);
Xn1=abs(Xn);
phi=57.3*angle(Xn);
%==========================================================================
subplot(221);
plot(t,xa);grid on;
title('The curve of x(t)');
axis([0,t1,min(xn),max(xn)])
subplot(223)
stem(n,xn,'r.');grid on;
title('The curve of x(n)');
axis([0,L,min(xn),max(xn)])
xlabel('Time index n/t');
subplot(222)
plot(W/(2*pi),Xa1)
grid on;
axis([-fs,fs,0,max(Xa1)]);
title('The CTFT of xa(t)');
subplot(224)
plot(w/(2*pi),Xn1)
title('The DTFT of x(n)');
xlabel('Hz/*2pi');grid on;
axis([-1,1,0,max(Xn1)]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -