# Computing the Hilbert transform via Fourier transform

1. Jan 21, 2013

### hunt_mat

I know the result: $$\widehat{H(f)}=i\textrm{sgn}\hspace{1mm}(k)\hat{f}$$

I thought I could use fft, and ifft to compute the transform easily, is there a MATLAB command for sgn?

Mat

2. Jan 21, 2013

### NemoReally

Yes, sign!

sign
Signum function

Syntax
Y = sign(X)

Description
Y = sign(X) returns an array Y the same size as X, where each element of Y is:

1 if the corresponding element of X is greater than zero

0 if the corresponding element of X equals zero

-1 if the corresponding element of X is less than zero

For nonzero complex X, sign(X) = X./abs(X).

3. Jan 21, 2013

### hunt_mat

Is it okay for computing the Hilbert transform?