I asked this at Stack Overflow, they told me to come here.

First, please excuse my ignorance in this field, I'm a programmer by trade but have been stuck in a situation a little beyond my expertise (in math and signals processing).

I have a Matlab script that I need to port to a C++ program (without compiling the matlab code into a DLL). It uses the hilbert() function with one argument. I'm trying to find a way to implement the same thing in C++ (i.e. have a function that also takes only one argument, and returns the same values).

I have read up on ways of using FFT and IFFT to build it, but can't seem to get anything as simple as the Matlab version. The main thing is that I need it to work on a 128*2000 matrix, and nothing I've found in my search has showed me how to do that.

I would be OK with either a complex value returned, or just the absolute value. The simpler it is to integrate into the code, the better.

Thank you.


If your application can use LGPL open-source code, you could reuse the code for the Remez exchange algorithm in the GNU Octave source. I've got a standalone library that does that at www.ke5fx.com/dsplib.zip . See if the function DSP_FIR_PM_Hilbert_transformer_design() does what you want.

The FIR filters implemented by my library are one-dimensional affairs, so if you actually need to do a 2D transform, that would be left as an exercise, so to speak. Contributions back to dsplib are welcome!

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.