加速Framework FFT vDSPztoc拆分实数形式以拆分实向量 [英] Accelerate Framework FFT vDSPztoc split real form to split real vector

查看:167
本文介绍了加速Framework FFT vDSPztoc拆分实数形式以拆分实向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Accelerate Framework在iOS中实现基于加速度计的FFT,但我仍然有些困惑的是这部分:

I am implementing an accelerometer-based FFT in iOS using the Accelerate Framework, but the one thing that I'm still a bit confused about is this part:

/* The output signal is now in a split real form.  Use the  function
 * vDSP_ztoc to get a split real vector. */
 vDSP_ztoc(&A, 1, (COMPLEX *) obtainedReal, 2, nOver2);

最终数组是什么样的?
我对拆分实数形式和拆分实数向量之间的区别感到困惑。我可能对它的含义有所了解,但是我想确保自己有个正确的想法。

What does the final array look like? I'm confused as to the distinction between "split real form" and "split real vector". I might have some understanding of what it means, but I want to be sure I have the right idea.

起始数据是一个双精度数组,表示输入数据,例如通过vDSP_ctoz将加速度设置为奇数形式。然后结果是这种形式的(从Apple的vDSP Guide复制):

The starting data, an array of doubles, representing input data such as acceleration is put into even-odd form via vDSP_ctoz. Then the result is in this form (copied from Apple's vDSP Guide):

{[DC,0],C[1],C[2],...,C[n/2],[NY,0],Cc[n/2],...,Cc[2],Cc[1]}

 where
 1. DC and NY are the dc and nyquist components (real valued),
 2. C is complex in a split representation,
 3. Cc is the complex conjugate of C in a split representation.

For an n size real array A, the complex results require 2n
 spaces.  In order to fit the 2n size result into an n size  input and
 since the complex conjugates are duplicate information, the  real
 FFT produces its results as follows:
   {[DC,NY],C[1],C[2],...,C[n/2]}

在我的实现中(有效,我只是对输出感到困惑),我还调用了vDSP_ztoc。是应该执行此调用,还是仅在示例中完成该调用,因为他们要还原数组以使其与原始数组匹配(因为他们进行了反向转换)?

In my implementation (which works, I'm just confused about the output), I also have a call to vDSP_ztoc. Should it have this call, or is that only done in the example because they want to restore the array to match the original one (as they did a reverse transform)?

如果您应该这样称呼,vDSP_ztoc之后的最终形式是什么?是吗?

If you are supposed to call that, what's the final form after vDSP_ztoc? Is it:

   {[DC,NY],C[1],C[2],...,C[n/2]}

或者是输出数组中的第一个元素是DC,第二个是第一个bin的实部,第三个是第一个bin的虚部,依此类推?还是第二个元素像奈奎斯特频率那样设置,从而使第三个和第四个元素成为第一个bin的实部和虚部?

Or is the first element in the output array is DC, the second is the first bin's real part the third is the first bin's imaginary part, and so on? Or is the second element the Nyquist frequency like in that setup, making the third and fourth element the real and imaginary components of the first bin?

这还不清楚,但是我想这个问题非常简单,我只需要快速确认/纠正即可。

It's a bit unclear, but I imagine that this question is very straightforward, and all I need is a quick confirmation / correction.

谢谢!

推荐答案

因此,最终形式
{C [0],C [1],C [2],。 ..,C [n / 2]}
是正确的。

So the final form {C[0],C[1],C[2],...,C[n/2]} is correct.

每个bin的频率是$ b $,如其他类似线程中所述b F = Fs / N
其中Fs是采样频率,N是输入数组中元素的总数。您最终得到N / 2个复数(虚数为实数的一半)。

And the frequency of each bin is, as described in other similar threads is F = Fs/N Where Fs is the sampling frequency, N is the total number of elements in the input array. You end up with N/2 complex numbers (with half real half imaginary).

这篇关于加速Framework FFT vDSPztoc拆分实数形式以拆分实向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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