Javert
Member level 2
- Joined
- Sep 14, 2019
- Messages
- 44
- Helped
- 0
- Reputation
- 0
- Reaction score
- 1
- Trophy points
- 8
- Activity points
- 551
The former is legal C syntax, although rather unusual. If your C compiler is compliant to C-standard it should accept the code. You can select "C++" style in FiltersSolutions code generator to get the latter parameter declaration form.1. The code begins
float DigFil(invar, setic)
float invar; int setic;
{}
i think it's a erroe and and it should be
float DigFil( float invar, int setic)
{}
Not particularly. The main calculation effort is the sumden and sumnum loop which has to be performed for each time step. Due to the recursive operation of IIR, little would be saved if you execute the filter function for a block of N samples.note on the introduction
- for the case when there are N samples in the buffer, this method is not very efficient, the function is called 100x better to override and pass the entire inputbuffer and outputbuffer fields
Failed expectation. You overlook the very small filter bandwidth which results in long settling time (many seconds) until the filter reaches steady state.The main thing, the inputbuffer only contains a 187 Hz signal, so I would expect a very similar signal in the outputbuffer because Pass Band Attenuation = 1 dB
float Fs = 4000.0;
float F = 186.66;
const int N = 240;
float wave[N];
float filter;
for (int i = 0; i < N; i++)
{
wave = sin(2 * PI * F * i / Fs);
filter = DigFil(wave, 0, 0);
fs << wave <<" ; " << filter << std::endl;
}
I don't see any shift(if you mean dc offset). Check zero line carefullySame in double with 10 digit coefficient
The noise is removed, the only thing that maybe surprises me is the shift of 186.7 at the output of the filter towards positive values, see the bottom picture.
View attachment 179107
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?