Introduction - If you have any usage issues, please Google them yourself
empirical formula with kaiser
clc
clear all
fs=1000
fc=250
df=50
r=0.001
f=fc/fs
dw=2*pi*(df/fs)
a=-20*log(r)
n=floor(((a-8)/(2.285*dw))+1)
if a>50
b=0.1102*(a-8.7)
elseif a>=21 && a<=50
b=0.5842*((a-21)^0.4)+0.07886*(a-21)
elseif a<21
b=0.0
end
w=kaiser(n,b)
for i=1:n
if i~=(n-1)/2
hd(i)= (2*f*sin((i-((n-1)/2))*2*pi*f))/((i-((n-1)/2))*2*pi*f)
elseif i==(n-1)/2
hd(i)=2*f
end
end
for j=1:n
h(j)=w(j)*hd(j)
end
subplot(3,1,1), plot(w)
subplot(3,1,2), plot(h)
subplot(3,1,3), plot(h,n)