具体代码如下:
Ts = 0.1;
N = 500;
t = 1 : Ts : Ts*(N-1);
x1 = tripuls(t-10,1);
x2 = tripuls(t-40,1);
figure(1);
subplot(321)
plot(t,x1);
subplot(322)
plot(t,x2);
[f1,X1] = T2F(t,x1);
[f2,X2] = T2F(t,x2);
subplot(323)
plot(f1,abs(X1));
subplot(324)
plot(f2,abs(X2));
subplot(325)
plot(f1,angle(X1));
subplot(326)
plot(f2,angle(X2));
输出结果如下:
可以看到,对于时域移位,频域幅度没有变化,但相位会发生变化