Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

How to make the filter function of an IIR filter if coefficients are available

$
0
0

Hello,I am using CCS.

I want to know how to build an IIR filter function if the filter coefficients got fromm matlab are available.
The lowpass IIR filter designed in matlab is shown below with fc=4Hz,sample frequency=100Hz

[b,a] = cheby1(2,0.5,4/50,'low');
filter_output=filtfilt(b,a,signal);

I used the below filter function fro FIR_filter to filter my ADC sample with filter coefficients(32) generated from Matlab 

coeff[32]=[ ...........];

int FIR_filter(int ADC_sample)
{
long z=0;
for (k=0;k<30;k++)
{
Buf[k+1]=Buf[k];
}

Buf[0]=ADC_sample;

for (i = 0; i < 31; i++)
z += mul16(coeffs[i], Buf[i]);

check=coeffs[i];
return z >> 15;
}

But I am not sure of how to make IIR filtering.can someone please explain me how to build the IIR filter function for generated IIR filter coefficients to filter the ADC samplementioned above.

Thanks.


Viewing all articles
Browse latest Browse all 17527

Trending Articles