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.


closed as off-topic by datageist Jul 23 '16 at 20:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions requesting working code written to a specification are off-topic as they are unlikely to benefit anyone else. Instead, describe the problem you're solving and where you're stuck." – datageist
If this question can be reworded to fit the rules in the help center, please edit the question.


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!


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