Forum Discussion
Band Pass filter output data
Hi everyone,
I use FIR compiler v8.1 to generate a band pass filter 50hz Configuration : - Input Data unsigned width : 8 bits - I use a coef file generated by Matlab - coefficients scaling : Auto ... Bit Width : 8 --- Quote Start --- -0.03758602 -0.04600525 -0.05416903 -0.05998012 -0.05842221 -0.04470215 -0.01824851 0.01576782 0.04887938 0.07399496 0.08870862 0.09481480 0.09481480 0.08870862 0.07399496 0.04887938 0.01576782 -0.01824851 -0.04470215 -0.05842221 -0.05998012 -0.05416903 -0.04600525 -0.03758602 --- Quote End --- and I try to undestand why i have a signed data out ( see image ) fir data in/out (http://img190.imageshack.us/img190/9161/firbp.jpg)21 Replies
- Altera_Forum
Honored Contributor
Your coefficients are signed but your input is declared unsigned. I believe this will cause trouble. You can declare your input as signed adding the sign bit = '0' always and see.
- Altera_Forum
Honored Contributor
one more issue.
You should expect that your output will revert back to signed. The reason is your filter doesn't pass dc. if your input is unsigned it implies dc offset which is filtered off. - Altera_Forum
Honored Contributor
I can't use signed data in because it's provided from unsigned FIR LP.
Sorry but I don't understand the relation with DC... In this case, what should i do - Altera_Forum
Honored Contributor
In that case your input is always treated as positive only i.e. there is dc offset in it (dc equals the mean of the signal). You can remove this by subtraction but better leave it and your bandpass filter will remove the mean. Hence your output will be signed and tending to around zero. There is nothing wrong in this case.
- Altera_Forum
Honored Contributor
Ok... Thank you
- Altera_Forum
Honored Contributor
Now with signed filter i have this ( image (http://img200.imageshack.us/img200/1601/firbp2.png) )
Why the output signal is discontinuous ? - Altera_Forum
Honored Contributor
You mean your output gets stuck for many samples on same value before it moves to next...
Can you post your input data and output data values and I will get output data through matlab - Altera_Forum
Honored Contributor
Thanks for your help
you will find an attachment with input and output data - Altera_Forum
Honored Contributor
Your output doesn't look right.
your input swings between 0 and 243, yet your output is of +160,000 order with repeated close values.It doesn't look you have done any bit truncations. Go to matlab and type: h = < your above coefficients>; x = <your input vector>; now apply filter: y = filter(h,1,x); you should check your results against this as reference I got an initial y values of +80 followed by +4 - Altera_Forum
Honored Contributor
I got the same thing and i don't know how to resolve the problem!!!!