Mercurial > hg > pmhd
view genbh92lobe.m @ 13:844d341cf643 tip
Back up before ISMIR
author | Yading Song <yading.song@eecs.qmul.ac.uk> |
---|---|
date | Thu, 31 Oct 2013 13:17:06 +0000 |
parents | f445c3017523 |
children |
line wrap: on
line source
function y = genbh92lobe(x) % Calculate transform of the Blackman-Harris 92dB window % x: bin positions to compute (real values), y: transform values N = 512; f = x*pi*2/N; % frequency sampling df = 2*pi/N; y = zeros(size(x)); % initialize window consts = [.35875, .48829, .14128, .01168]; % window constants for m=0:3 y = y + consts(m+1)/2*(D(f-df*m,N)+D(f+df*m,N)); % sum Dirichlet kernels end y = y/N/consts(1); % normalize end function y = D(x,N) % Calculate rectangular window transform (Dirichlet kernel) y = sin(N*x/2)./sin(x/2); y(find(y~=y))=N; % avoid NaN if x==0 end