% Test FFT symmetry
% FFTsymmetry.m
x = [1 1 1  zeros(1,11) 1 1]; % Define 5-point boxcar with FFT symmetry
subplot(2,2,1)
plot(x,'.r','linewidth',2,'markersize',25)
title('5-point boxcar, FFT symmetry, length of array = 16','fontsize',14)
axis([1 16 0 1]);
x1 = fftshift(x);
x1 = fliplr(x1);
t1 = [-7:1:8];
subplot(2,2,2)
plot(t1,x1,'.r','linewidth',2,'markersize',25)
title('5-point boxcar, origin-centered symmetry','fontsize',14)
axis([-8 8 0 1]);
X = fft(x,16);
rX = real(X);
subplot(2,2,3)
plot(rX,'.r','linewidth',2,'markersize',25)
title('FFT of 5-point boxcar, FFT symmetry','fontsize',14)
axis([1 16 -2 6]);
rX1 = fftshift(rX);
rX1 = fliplr(rX1);
t1 = [-7:1:8];
subplot(2,2,4)
plot(t1,rX1,'.r','linewidth',2,'markersize',25)
title('FFT of 5-point boxcar, origin-centered symmetry','fontsize',14)
axis([-8 8 -2 6]);