annotate extra/peakinterp.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 6840f77b83aa
children
rev   line source
yading@10 1 function [iploc, ipmag, ipphase] = peakinterp(mX, pX, ploc)
yading@10 2 % Parabolic interpolation of spectral peaks
yading@10 3 % mX: magnitude spectrum, pX: phase spectrum, ploc: locations of peaks
yading@10 4 % iploc, ipmag, ipphase: interpolated values
yading@10 5 % note that ploc values are assumed to be between 2 and length(mX)-1
yading@10 6 val = mX(ploc); % magnitude of peak bin
yading@10 7 lval = mX(ploc-1); % magnitude of bin at left
yading@10 8 rval= mX(ploc+1); % magnitude of bin at right
yading@10 9 iploc = ploc + .5*(lval-rval)./(lval-2*val+rval); % center of parabola
yading@10 10 ipmag = val-.25*(lval-rval).*(iploc-ploc); % magnitude of peaks
yading@10 11 ipphase = interp1(1:length(pX),pX,iploc,'linear'); % phase of peaks