Does anyone know how to implement the cascade of Fir Filters using c programming given filter coefficients generated by matlab. Any rough idea or sample code.
Does anyone know how to implement the cascade of Fir Filters using c programming given filter coefficients generated by matlab. Any rough idea or sample code.
the simple way: create an array of the length of the filter. put your samples in the array, oldest first to newest. multiply each element Sn in the array by the corresponding coefficient Cn to get the output for that iteration. then for the next sample, delete the oldest element by moving each element to the left by 1. then add the new sample at the end of the array. recompute etc.
a more efficient way would be to use the array as a circular buffer : google 'circular buffer C'
or use a linked list where you can delete from the front and add to the end.