sam_andrew:
Do you know any code examples where filter coefficients are used to implement a filter in Arduino, both as an FIR and an IIR filter? That would really clear up my concepts, I only seem to know the theory of IIR and FIR but nothing about actual implementation.
There may be optimizations possible with specific filter coefficients, but a direct implementation of a FIR filter implementing the convolution is straightforward.
y=0; //will contain next filter output
for (i=0; i<LEN; i++)
{
y = y + w[i]*x[i]; // w is vector of FIR coefficients, x is vector of recent input samples
}
IIR is left as an exercise for the student, but it isn't much different.