目录
1、三角形脉冲信号的频谱波形
2、MATLAB代码实现
clear all;
clc;
% f(t)
tau = 4;
t_vector = -4:0.01:4;
N = length(t_vector);
f_t = zeros(1,N);
for n = 1:N
t = t_vector(n);
if (t>=-tau/2)&&(t<=tau/2)
f_t(1,n) = 1 - (2/tau)*abs(t);
end
end
figure; subplot(2,1,1);
plot(t_vector,f_t,'b-');
xlabel('t'); title('f(t)');
axis([-4,4,-0.5,1.5]);
grid on;
% F(jw)=FT[f(t)]
lower = - 15;
upper = 15;
step = (upper-lower)/100;
w_vector = lower:step:upper;
K = length(w_vector);
X = zeros(1,K);
for k = 1:K
w