我想在 C 中实现lattice fir滤波器。我的问题是如何设置延迟时间(z-1)。我尝试计算每次迭代的前一个样本,但是对于第 M 个第一个样本,我有一个负值。
您可以找到算法here
最佳答案
p
是一个指向 float
的指针,i
是一个 short int
。您在循环条件中将 p
分配给 i
:
void LatticeFIR(…, float *p)
{
short i;
…
for (i=1;i=p;i++)
这实际上没有任何意义。如果你这样做,你的编译器应该会发出大量警告。
编辑: 只是为了给您一个想法,这就是 clang -Wall
对此的说法:
x.c:4:14: warning: incompatible pointer to integer
conversion assigning to 'short' from 'float *' [-Wint-conversion]
for(i=1;i=p;i++)
^~
x.c:4:14: warning: using the result of an assignment
as a condition without parentheses [-Wparentheses]
for(i=1;i=p;i++)
~^~
x.c:4:14: note: place parentheses around the assignment
to silence this warning
for(i=1;i=p;i++)
^
( )
x.c:4:14: note: use '==' to turn this assignment into
an equality comparison
for(i=1;i=p;i++)
^
==
2 warnings generated.
关于c - C 编程中的格子冷杉滤波器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44496859/