如何看懂这段matlab代码
% Program3_1
clear, close all,
tmax = 4; dt = 0.01;
t = 0:dt:tmax;
Ts = 1/10;
ws = 2*pi/Ts;
w0 = 20*pi; dw = 0.1;
w = -w0:dw:w0;
n = 0:1:tmax/Ts;
x = exp(-4*t).*u(t);
xn = exp(-4*n*Ts);
subplot(221)
plot(t,x), title('A continuous-time signal x(t)'),
xlabel('Time t'), axis([0,tmax,0,1]), grid on
subplot(223)
stem(n,xn,'.'), title('The sampled version x[n] of x(t)'),
xlabel('Time index n'), axis([0,tmax/Ts,0,1]), grid on
Xa = x*exp(-j*t'*w)*dt;
X = 0;
for k = -8:8;
X = X + x*exp(-j*t'*(w-k*ws))*dt;
end
subplot(222)
plot(w,abs(Xa))
title('Magnitude spectrum of x(t)'), grid on
axis([-60,60,0,1.8*max(abs(Xa))])
subplot(224)
plot(w,abs(X))
title('Magnitude spectrum of x[n]'), xlabel('Frequency in radians/s'),grid on
axis([-60,60,0,1.8*max(abs(Xa))])
连续信号的时域图绘制,然后进行傅里叶变换,求出频谱再绘制频谱图。