clc
clear

M = 1024;
y = blackmanharris(1024);
yfft = fft(y,M)/M;
absyfft = abs(yfft);
absyfft2 = [absyfft(M/2+1:M);absyfft(1:M/2)];
% plot(20*log10(abs(absyfft2)),'m.-')
hold on
% 
% 
J = 81.08;
n = 0:M-1;
x = 0.5 + 0.5*cos(2*pi*J*n/M);
xw = x'.*y;
plot(20*log10(abs(fft(xw,M)/M)),'.-')

w = 2*pi/M;
a0 = 0.27105140069342;
a1 = 0.43329793923448;
a2 = 0.21812299954311;
a3 = 0.06592544638803;
a4 = 0.01081174209837;
a5 = 0.00077658482522;
a6 = 0.00001388721735;

wbh7 = a0 - a1*cos(w*n) + a2*cos(2*w*n) - a3*cos(3*w*n) + a4*cos(4*w*n) - a5*cos(5*w*n) + a6*cos(6*w*n);
% plot(wbh7,'.-')
yfft = fft(wbh7,M)/M;
absyfft = abs(yfft);
absyfft2 = [absyfft(M/2+1:M) absyfft(1:M/2)];
% plot(20*log10(abs(absyfft2)),'r.-')

x = 0.5 + 0.5*cos(2*pi*J*n/M);
xw = x.*wbh7;
plot(20*log10(abs(fft(xw,M)/M)),'r.-')