Sign in

username:

password:



Not a member?

Search Online Books



Search tips

Free Online Books



Chapters

Chapter Contents:

Search Spectral Audio Signal Processing

  

Book Index | Global Index


Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?

  

Comparison to use of the hilbert function

Suppose we happened upon the hilbert function in Matlab:

help hilbert

 HILBERT Hilbert transform.
        HILBERT(X) is the Hilbert transform of the real part
        of vector X.  The real part of the result is the original
        real data; the imaginary part is the actual Hilbert
        transform.  See also FFT and IFFT.
 
        If X is a signal matrix, HILBERT(X) transforms the columns
        of X independently.

We might think the easiest way to design our desired filter would be to call hilbert with an impulse signal $ \delta =
[1,0,\ldots,0]$. Let's try this and see what happens:

Nh = M-2; % This looks best
delta = [1,zeros(1,Nh)]; % zero-phase impulse
% hilbert() simply zeros the negative-frequency bins in the FFT:
hh = hilbert(delta); 
Hh = fft(hh); % Frequency response
Lh = length(Hh);
Hhp = [Hh(Lh/2+2:Lh), Hh(1:Lh/2+1)]; % Plot (-) freqs on the left
Hhpn = abs(Hhp); Hhpn = Hhpn/max(Hhpn);
fh = [0:Lh-1]/Lh - 0.5;
plot(fh,20*log10(Hhpn)); grid;
s = sprintf(...
  'Frequency Response of Length %d hilbert() using Matlab',Lh);
title(s); 
xlabel('Normalized Frequency (cycles/sample)'); 
ylabel('Gain (dB)')
if saveplots, saveplot('MatlabHilbertFR.eps'); end;
if dopause, disp('Pausing... RETURN to continue'); pause; end;
Figure B.22: FFT of impulse response designed using Matlab's Hilbert function.
\includegraphics[width=3.5in]{eps/MatlabHilbertFR}

This looks very good. However, let's zero-pad the returned impulse response to see what's really going on in the frequency response . . .

hhzp = [hh(Lh/2+1:Lh), zeros(1,N-Lh), hh(1:Lh/2)];
Hhzp = fft(hhzp); % Frequency response
Hhp = [Hhzp(N/2+2:N), Hhzp(1:N/2+1)]; % plot (-) freqs on the left
Hhpn = abs(Hhp); Hhpn = Hhpn/max(Hhpn);
f = [1:N]/N - 0.5;
plot(f,20*log10(Hhpn)); grid;
s=sprintf(...
  ['Interpolated Frequency Response of Length %d ',...
   'hilbert() using Matlab'],Lh);
title(s); 
xlabel('Normalized Frequency (cycles/sample)'); 
ylabel('Gain (dB)')
if saveplots, saveplot('MatlabHilbertInterpFR.eps'); end;
if dopause, disp('Pausing... RETURN to continue'); pause; end;

Figure B.23: Interpolated FFT of impulse response designed using Matlab's Hilbert function.
\includegraphics[width=3.5in]{eps/MatlabHilbertInterpFR}

% Zoom in on low-frequency transition band
kshow = N/20;
kzero = N/2+1; % index of frequency 0
krange = kzero-kshow : kzero+kshow;
frange = (krange - kzero)/N;
plot(frange,20*log10(Hhpn(krange))); grid; 
hold on; plot((k1-1)/N,1,'+'); hold off;
s = sprintf(...
  ['Low-Frequency Transition Band, ',...
   'f1/fs=%f (marked by "+")'],f1/fs);
title(s); 
xlabel('Normalized Frequency (cycles/sample)'); 
ylabel('Gain (dB)')
if saveplots, saveplot('MatlabHilbertInterpZoomFR.eps'); end;
if dopause, disp 'Pausing... RETURN to continue'; pause; end;

We found the following problems using hilbert:

  • The transition bandwidth is only 2 bins wide, which is not enough.

  • There is massive time aliasing.

  • This approach is only reasonable for periodic signals where the period is exactly equal to the filter length. Only in the periodic case is time aliasing equivalent to overlap-add from adjacent periods. More generally, any real signal given to hilbert() must be interpreted as precisely one period of a periodic signal.

Figure B.24: Zoom-in on Fig.B.23
\includegraphics[width=3.5in]{eps/MatlabHilbertInterpZoomFR}
.


Order a Hardcopy of Spectral Audio Signal Processing

Previous: Conclusions
Next: Generalized Window Method

written by Julius Orion Smith III
Julius Smith's background is in electrical engineering (BS Rice 1975, PhD Stanford 1983). He is presently Professor of Music and Associate Professor (by courtesy) of Electrical Engineering at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), teaching courses and pursuing research related to signal processing applied to music and audio systems. See http://ccrma.stanford.edu/~jos/ for details.


Comments


No comments yet for this page


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )