home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 8.ddi / SIGNAL.DI$ / HILBERT.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  938 b   |  37 lines

  1. function y = hilbert(x)
  2. %HILBERT Hilbert transform.
  3. %    HILBERT(X) is the Hilbert transform of the real part
  4. %    of vector X.  The real part of the result is the original
  5. %    real data; the imaginary part is the actual Hilbert
  6. %    transform.  See also FFT and IFFT.
  7. %
  8. %    If X is a signal matrix, HILBERT(X) transforms the columns
  9. %    of X independently.
  10.  
  11. %    Charles R. Denham, January 7, 1988.
  12. %    Revised by LS, 11-19-88, 5-22-90, TPK, 11-4-92
  13. %    Copyright (C) 1988, 1990, 1992 the MathWorks, Inc.
  14.  
  15. %    Modified to use power of 2 FFT Ken Creager 3-19-92
  16.  
  17. % Reference: Jon Claerbout, Introduction to
  18. %            Geophysical Data Analysis.
  19.  
  20. [r,c] = size(x);
  21. if r == 1
  22.     x = x.';   % make it a column
  23. end;
  24. [n,cc] = size(x);
  25. m = 2^nextpow2(n);
  26. y = fft(real(x),m);
  27. if m ~= 1
  28.     h = [1; 2*ones(fix((m-1)/2),1); 1; zeros(fix((m-1)/2),1)];
  29.     y(:) = y.*h(:, ones(1,cc) );
  30. end
  31. y = ifft(y,m);
  32. y = y(1:n,:);
  33. if r == 1
  34.     y = y.';
  35. end
  36.  
  37.