Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

% WRITE A MATLAB CODE FOR DESIGNING OF HAMMING WINDOW

clc;
clear;
fc= 250;
fs=1000;
M=61
hd=zeros(1,M)
n=-(M-1)/2:1:(M-1)/2;
for i=1:1:length(n)
hd(i)=(sin((n(i)+0.000001)*pi/2)/(2*((n(i)+0.000001)*
pi/2)))
end
whm=zeros(1,length(n))
for k= 1:1:M
whm(k)=0.54-0.46*cos(2*pi*(k-1)/(M-1))
end
hn=whm.*hd;
Hf=fft(hn,512);
plot(10*log10(abs(Hf))); axis([ 0 256 -40 5]);

% WRITE A MATLAB CODE FOR DESIGNING OF HANNING WINDOW


clc;
clear;
fc= 250;
fs=1000;
M=61
hd=zeros(1,M)
n=-(M-1)/2:1:(M-1)/2;
for i=1:1:length(n)
hd(i)=(sin((n(i)+0.000001)*pi/2)/(2*((n(i)+0.000001)*
pi/2)))
end
Whan=zeros(1,length(n))
for k= 1:1:M
Whan(k)=0.5+0.5*cos(2*pi*(k-1)/(M-1))
end
hn=Whan.*hd;
Hf=fft(hn,512);
plot(10*log10(abs(Hf))); axis([ 0 256 -40 5]);

% WRITE A MATLAB CODE FOR DESIGNING OF HANNING WINDOW


clc;
clear;
fc= 250;
fs=1000;
M=61
hd=zeros(1,M)
n=-(M-1)/2:1:(M-1)/2;
for i=1:1:length(n)
hd(i)=(sin((n(i)+0.000001)*pi/2)/(2*((n(i)+0.000001)*
pi/2)))
end
Whan=zeros(1,length(n))
for k= 1:1:M
Whan(k)=0.5+0.5*cos(2*pi*(k-1)/(M-1))
end
hn=Whan.*hd;
Hf=fft(hn,512);
plot(10*log10(abs(Hf))); axis([ 0 256 -40 5]);

You might also like