Matlab Hilbert变换在C ++ [英] Matlab Hilbert Transform in C++

查看:1224
本文介绍了Matlab Hilbert变换在C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,请原谅我在这个领域的无知,我是一个贸易程序员,但被困在一个超出我的专业知识(数学和信号处理)的情况。

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).

我有一个Matlab脚本,我需要移植到一个C ++程序(不编译matlab代码到DLL)。它使用带有一个参数的 hilbert()函数。我试图找到一种方法在C ++中实现相同的东西(即有一个函数,也只需要一个参数,并返回相同的值)。

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已经阅读了使用FFT和IFFT来构建它的方法,但是似乎没有像Matlab版本那样简单。主要的是,我需要它工作在一个128 * 2000矩阵,没有什么我发现在我的搜索已经告诉我如何做。

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.

谢谢。

推荐答案

MatLab函数hilbert()实际上不直接计算希尔伯特变换,而是计算分析信号,这是大多数情况下需要的。
它通过删除负频率(设置arry零的上半部分)和应用逆fft它做。如果你有一个体面的fft实现,这将是直接在C / C ++(三行代码)。

The MatLab function hilbert() does actually not compute the Hilbert transform directly but instead it computes the analytical signal, which is the thing one needs in most cases. It does it by taking the fft deleting the negative frequencies (setting the upper half of the arry zero) and applying the inverse fft. It would be straight forward in C/C++ (three lines of code) if you've got a decent fft-implementation.

这篇关于Matlab Hilbert变换在C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆