📄 example6_0.m
字号:
% ======================================================================
% Example6_0
%========================================================================
clear,close all
t1=2;
p=0.001;
t=-t1:p:t1;
T=1;
x1=1+0.5*cos(2*pi*t+1.2)+cos(4*pi*t+4.1)+2*cos(6*pi*t-7.02)/3;
x2=x1.*(u(t+T/2)-u(t-T/2));
N=3;
L=2*N+1;
k=-N:N;
for r=1:L;
an(r)=(1/T)*x2*exp(-j*((-(L-1)/2+r-1)*2*pi/T)*t')*p;
phi(r)=atan(imag(an(r))/real(an(r)));
end
subplot(211)
plot(t,x1)
axis([-t1,t1,-2,4])
title('The original signal x(t)')
xlabel('Time t'),grid on,
subplot(223)
k=-N:N;
stem(k,abs(an),'r.')
title('The amplitude ak of x(t)')
axis([-N,N,0,1.2])
grid on,xlabel('Frequency index k')
subplot(224)
k=-N:N;
stem(k,phi,'r.')
title('The phase of x(t)')
axis([-N,N,-pi,pi])
xlabel('Frequency index k')
grid on,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -