function [w,beta]=kaiserwindow(M,As) % % usage % w=kaiserwindow(M,As) % % Computes the M point Kaiser window for FIR filter design. As is the minimum % desired stopband attentuation in dB, i.e., % % -20log10|H(F)| > As, if F is in filter stopband. % % As = 60 dB is used if not entered. % % Note that the transition width for the Kaiser window is % % deltaF = (As-8)/(2*pi*2.285*M); % % R Kakarala % UCB Extension if (nargin<2) As = 60; % default attenuation in dB end; % calculate the window shape parameter "beta" % formulas from Oppenheim and Shafer, DISCRETE-TIME % SIGNAL PROCESSING, 2nd eg, pg 474. if (As<21) beta=0; else % As >= 21 if (As>50) beta = 0.1102*(As - 8.7); else % As>=21 and As<=50 beta = 0.5842*(As-21)^0.4 + 0.07886*(As-21); end; end; % compute window n=0:M-1; nc=n-(M-1)/2; %centered nn=nc/((M-1)/2); %normalized w = besseli(0,beta*sqrt(1-nn.^2))/besseli(0,beta);