Le 20/10/2016 à 01:07, katja a écrit :
[...]
For the filter recipe the curve must go through coordinates [0 1] and
[pi -1], to get the expected behavior when cutoff frequency is set to
DC or Nyquist. [hip~ 0] should not block DC, which is only possible
when the coefficient is exactly 1 like you get it with
(1-sin(0))/cos(0). I tuned my factors 'by hand' to do so. That may be
possible with your libre office result as well.
yes, in my example the result is slightly different from 1 / -1.
i tried again, adding about 20 points for X=0 and X=1 to get more weight for
this coordinate.
the coef where better, but not perfect.
still it's a good starting point for manual adjustment.
That's what I thought, avoiding the initial guess iterations saves a
lot of time. Can you post your adjusted parameters? Being an
approximation the function will never be perfect. We can select the
best frequency response compromise.
libre office say :
-1.5743519661 X
-1.1794365231 X^3
-2.0916936873 X^5
(for X between -0.5 / 0.5)
However, when done in
double precision the calculation will give slightly different result.
Above or below 1, I don't know yet. In any case this has to be
considered when writing the C.
shouldn’t it be clipped? (what is a filter with negative frequency, or
frequency above Nyquist?)
Yes coefficients below -1 and above 1 must be clipped. But what if it
doesn't reach 1 at DC or -1 at Nyquist in double precision because of
the rounding difference. The behavior at those extremes would be
incorrect. Not that it matters now, we don't have double precision pd.
But code written today should be double-precision-proof, you never
know what will happen tomorrow.
since we know that aX + bX³ + cX⁵ should be 1 for X = -0.5, we can automatically adjust
"a" to:
a = 1 - b*0.5³ - c*0.5⁵
using only b and c from the polynomial regression.
(since the function is odd, it will also work for X = 0.5)
I did not try, but apart from rounding error, it should satisfy the extreme condition
whatever precision is used, as long as "a" is computed in the C code.
(the pi value I used in libreoffice is not double precision accurate anyhow).
cheers
c
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list