home *** CD-ROM | disk | FTP | other *** search
- function y = hilbert(x)
- %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.
-
- % Charles R. Denham, January 7, 1988.
- % Revised by LS, 11-19-88, 5-22-90, TPK, 11-4-92
- % Copyright (C) 1988, 1990, 1992 the MathWorks, Inc.
-
- % Modified to use power of 2 FFT Ken Creager 3-19-92
-
- % Reference: Jon Claerbout, Introduction to
- % Geophysical Data Analysis.
-
- [r,c] = size(x);
- if r == 1
- x = x.'; % make it a column
- end;
- [n,cc] = size(x);
- m = 2^nextpow2(n);
- y = fft(real(x),m);
- if m ~= 1
- h = [1; 2*ones(fix((m-1)/2),1); 1; zeros(fix((m-1)/2),1)];
- y(:) = y.*h(:, ones(1,cc) );
- end
- y = ifft(y,m);
- y = y(1:n,:);
- if r == 1
- y = y.';
- end
-
-