【发布时间】:2012-05-17 12:45:37
【问题描述】:
我正在使用 Accelerate Framework 在 iOS 中实现基于加速度计的 FFT,但我仍然有点困惑的是这部分:
/* 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);
最终的数组是什么样子的? 我对“分裂实形”和“分裂实向量”之间的区别感到困惑。我可能对它的含义有所了解,但我想确定我的想法是正确的。
起始数据,一个双精度数组,表示加速度等输入数据,通过 vDSP_ctoz 转换为奇偶形式。那么结果就是这种形式(抄自 Apple 的 vDSP 指南):
{[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。它应该有这个调用,还是只在示例中这样做是因为他们想要恢复数组以匹配原始数组(因为他们做了反向转换)?
如果你应该调用它,那么 vDSP_ztoc 之后的最终形式是什么?是吗:
{[DC,NY],C[1],C[2],...,C[n/2]}
或者输出数组中的第一个元素是 DC,第二个是第一个 bin 的实部,第三个是第一个 bin 的虚部,等等?还是第二个元素是该设置中的奈奎斯特频率,使第三个和第四个元素成为第一个 bin 的实部和虚部?
有点不清楚,但我想这个问题很简单,我所需要的只是快速确认/更正。
谢谢!
【问题讨论】:
-
我想现在你应该调用解包器,最终输出如上图。
标签: ios signal-processing fft accelerate-framework