Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

patan.gova

Full Member level 3
Full Member level 3
Joined
Dec 19, 2011
Messages
172
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,296
Visit site
Activity points
2,776
Hello,

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

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

I used the below filter function 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, Buf);

check=coeffs;
return z >> 15;
}

can someone please explain me how to build the IIR filter function for generated IIR filter coefficients to filter the ADC samplementioned above.

Thanks.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top