CZT
This algorithm is applicable to the scenario where the reciprocal of the product of the sampling frequency interval and sampling time interval is not equal to the time-frequency distribution area of the signal.
The calculation formula is as follows:
, 
The preceding formula is equivalent to FFT.
The function interface declaration is as follows:
Main functions:
HmppResult HMPPS_CZT_32f(const float *src, int32_t srcLen, Hmpp32fc *dst, int32_t dstLen, Hmpp32fc w, Hmpp32fc a);
HmppResult HMPPS_CZT_64f(const double *src, int32_t srcLen, Hmpp64fc *dst, int32_t dstLen, Hmpp64fc w, Hmpp64fc a);
HmppResult HMPPS_CZT_32fc(const Hmpp32fc *src, int32_t srcLen, Hmpp32fc *dst, int32_t dstLen, Hmpp32fc w, Hmpp32fc a);
HmppResult HMPPS_CZT_64fc(const Hmpp64fc *src, int32_t srcLen, Hmpp64fc *dst, int32_t dstLen, Hmpp64fc w, Hmpp64fc a);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
src |
Pointer to the source vector |
The value cannot be NULL. |
Input |
srcLen |
Number of elements in the source vector |
(0, INT_MAX] |
Input |
dst |
Pointer to the destination vector |
The value cannot be NULL. |
Input |
dstLen |
Number of elements in the destination vector |
(0, INT_MAX] |
Output |
w |
Ratio of the points on the helical wheel at the z plane |
The general modulus is 1. |
Input |
a |
Start point of the helical wheel at the z plane |
The general modulus is 1. |
Input |
Return Value
- Success: HMPP_STS_NO_ERR
- Failure: An error code is returned.
Error Codes
Error Code |
Description |
|---|---|
HMPP_STS_NO_ERR |
No error occurs. |
HMPP_STS_NULL_PTR_ERR |
Any of the specified pointers is NULL. |
HMPP_STS_SIZE_ERR |
The value of srcLen or dstLen is less than or equal to 0. |
HMPP_STS_OVERFLOW_ERR |
The data size (specified by srcLen and dstLen) is too large. |
HMPP_STS_MALLOC_FAILED |
The required memory fails to be allocated during computation. |
Example
void Convolve_Example()
{
const int srcLen = 10;
const int dstLen = 20;
float src[srcLen] = {9.244539, 0.686178, 4.528434, 7.181965, 6.123716, 5.890331, 2.779223, 1.576141, 3.751002, 8.829503};
Hmpp32fc dst[dstLen];
Hmpp32fc a = {0.306101, 0.951999};
Hmpp32fc w = {-0.562033, -0.827115};
HMPPS_CZT_32f(src, srcLen, dst, dstLen, w, a);
for (int i = 0; i < dstLen; ++i) {
printf("%.5f + %.5fi ", dst[i].re, dst[i].im);
}
}
Output:
7.35142 + 13.7323i, 14.6336 + 4.04731i, 6.05243 + 4.48011i, 17.1773 + -1.37873i, 10.6023 + -5.12952i, -3.68937 + 11.8929i, 2.38356 + -4.45827i, 5.83655 + 2.65852i, 17.3432 + 32.6026i, 5.83083 + 9.56965i, 16.495 + 1.73368i, 49.9786 + 6.41107i, 17.4045 + 2.00529i, 10.1817 + -10.0219i, 28.4027 + -31.2852i, 8.1634 + -4.72801i, 0.304818 + 0.486745i, -2.72213 + -18.6895i, 7.71386 + 4.53396i, 14.2174 + 5.30225i,