Goertz
为单个信号计算给定频率的离散傅里叶变换。
函数接口声明如下:
浮点数的操作:
HmppResult HMPPS_Goertz_32f(const float *src, int32_t len, Hmpp32fc *res, float freq)
HmppResult HMPPS_Goertz_64f(const double *src, int32_t len, Hmpp64fc *res, double freq);
HmppResult HMPPS_Goertz_32fc(const Hmpp32fc *src, int32_t len, Hmpp32fc *res, float freq);
HmppResult HMPPS_Goertz_64fc(const Hmpp64fc *src, int32_t len, Hmpp64fc *res, double freq);
参数
参数名 |
描述 |
取值范围 |
输入/输出 |
---|---|---|---|
src |
指向源向量的指针。 |
非空 |
输入 |
len |
源向量长度。 |
(0,INT_MAX] |
输入 |
res |
指向结果值的指针。 |
非空 |
输出 |
freq |
傅里叶变换频率 |
[0.0, 1.0) |
输入 |
返回值
- 成功:返回HMPP_STS_NO_ERR。
- 失败:返回错误码。
错误码
错误码 |
描述 |
---|---|
HMPP_STS_NULL_PTR_ERR |
src、res这几个入参中存在空指针。 |
HMPP_STS_SIZE_ERR |
len小于或等于0。 |
HMPP_STS_REL_FREQ_ERR |
freq不在[0.0, 1.0)范围内 |
示例
void Goertz_Example(void) { float src[7] = {1, 2, 3, 4, 5, 6, 7}; Hmpp32fc res; int32_t i; HmppResult result = HMPPS_Goertz_32f(src, 7, &res, 1.0 / 7); printf("re = %f, im = %f\n", res.re, res.im); }
运行结果:
re = -3.499998, im = 7.267825
父主题: 变换算法