假设有如此两路输入信号:
clear;
clc;
N = 1000;
fs = 100;
dt = 1/fs;
t = 0:dt:N*dt-dt;
xt1 = ones(1, N);
t1 = 101:200;
xt1(101:200) = cos((t1-100)*2/pi);
xt2 = ones(1, N);
t2 = 801:900;
xt2(801:900) = cos((t2-800)*2/pi);
xf1 = fft(xt1);
xf2 = fft(xt2);
figure(1);
subplot(3,2,1);plot(t,xt1);grid on;axis([0 10 -2 2]);title("xt1");
subplot(3,2,3);plot(abs(xf1));grid on;axis([0 100 -50 100]);title("abs(xf1)");
subplot(3,2,5);plot(rad2deg(angle(xf1)));title('rad(xf1)');
subplot(3,2,2);plot(t,xt2);grid on;axis([0 10 -2 2]);title("xt2");
subplot(3,2,4);plot(abs(xf2));grid on;axis([0 100 -50 100]);title("abs(xf2)");
subplot(3,2,6);plot(rad2deg(angle(xf2)));title('rad(xf2)');
clear;
clc;
N = 1000;
fs