Window Function
Window Function
APPARATUS- MATLAB 7.5.0(R2007b) PROCEDURE Open MATLAB Open new M file Type the program code Save, Compile and run the program See the output on command window or figure window
THEORYBLACKMANw = blackman(L) returns the L-point symmetric Blackman window in the column vector w, where L is a positive integer. w = Blackman (L,'sflag') returns an L-point Blackman window using the window sampling specified by 'sflag', which can be either 'periodic' or 'symmetric' (the default). The 'periodic' flag is useful for DFT/FFT purposes, such as in spectral analysis. The DFT/FFT contains an implicit periodic extension and the periodic flag enables a signal windowed with a periodic window to have perfect periodic extension. When 'periodic' is specified, blackman computes a length L+1 window and returns the first L points. When using windows for filter design, the 'symmetric' flag should be used. HAMMINGw = hamming(L) returns an L-point symmetric Hamming window in the column vector w. L should be a positive integer. The coefficients of a Hamming window are computed from the following equation. The window length is w = hamming (L,'sflag') returns an L-point Hamming window using the window sampling specified by 'sflag', which can be either 'periodic' or 'symmetric' (the default). The 'periodic' flag is useful for DFT/FFT purposes, such as in spectral analysis. The DFT/FFT contains an implicit periodic extension and the periodic flag enables a signal windowed with a periodic window to have perfect periodic extension. When 'periodic' is specified, hamming computes a length L+1 window and returns the first L points. When using windows for filter design, the 'symmetric' flag should be used. KAISER[1]
w = Kaiser (L,beta) returns an L-point Kaiser window in the column vector w. beta is the Kaiser window parameter that affects the sidelobe attenuation of the Fourier transform of the window. The default value for beta is 0.5.To obtain a Kaiser window that designs an FIR filter with sidelobe attenuation of a dB, use the following . Increasing beta widens the main lobe and decreases the amplitude of the sidelobes (i.e., increases the attenuation).
PROGRAMKAISER
N=50; Wn=0.4; coef=fir1(N,Wn,kaiser(N+1,5.653)) disp('coef') [H,W]=freqz(coef,1,500) plot(W/pi,abs(H)); title('fir filter') xlabel('freq') ylabel('magnitude')
BLACKMANN
N=50; Wn=0.4; coef=fir1(N,Wn,Blackman(N+1)) disp('coef') [H,W]=freqz(coef,1,500) plot(W/pi,abs(H)); title('fir filter') xlabel('freq') ylabel('magnitude')
[3]
HAMMINGN=50; Wn=0.4; coef=fir1(N,Wn,hamming(N+1)) disp('coef') [H,W]=freqz(coef,1,500) plot(W/pi,abs(H)); title('fir filter') xlabel('freq') ylabel('magnitude') OUTPUT USING HAMMING FUNCTION-
[4]
RESULT- Windowing function for implementation of FIR FILTER was verified using
Blackman, Hamming and Kaiser functions.
[5]