# Getting FIR filter coefficients from transfer function

Started by May 19, 2011
Hi all,

I'm trying to implement a low pass filter on a microcontroller, getting
coefficients in MATLAB. I have the transfer function in s-domain, so I am
using bilinear() to get the coefficients. This gives num and den (a and b
coefficients) for an IIR implementation. I would like to know if it possible
to get the coefficients for an FIR implementation of a filter, when you have
the transfer function in s-domain?

PS. I'm not from a DSP background, so I am not really sure if I am using the
right approach either.

Thanks
Anas,
Do you know the frequency characteristics of the transfer function in s-domain? If you are clear about it, you can use these specs as input arguments when invoke some FIR filter design functions like 'firpm' in Matlab, which will give you a more efficient filter coefficients than transfering from a analog prototype transfer function.
Regards,
Yongyi

-----原始邮件-----

Hi all,

I'm trying to implement a low pass filter on a microcontroller, getting coefficients in MATLAB. I have the transfer function in s-domain, so I am using bilinear() to get the coefficients. This gives num and den (a and b coefficients) for an IIR implementation. I would like to know if it possible to get the coefficients for an FIR implementation of a filter, when you have the transfer function in s-domain?
PS. I'm not from a DSP background, so I am not really sure if I am using the right approach either.
Thanks
Its been a long time since I read anything related to filter design
technique so things are not fresh..but I think the choice of whether you
want an FIR or IIR filter depends, both will probably work for you..You need
to first decide on what are your requirements and the frequency response
that you need.. Digitally, FIR filters are easier to implement and
intuitively easier o understand..
My advice would be, check the frequency response from the transfer function
that you have, and then design an FIR filter that can filter it adequatley
for you..As for choosing the right coefficients, Matlab will do that for you
but you need to look at the output in Matlab to choose the windowing you
need, and the order of the filter that suits your application.

On Thu, May 19, 2011 at 3:42 PM, Anas Imtiaz wrote:

> Hi,
>
> Is it possible to figure out from the s-domain (analogue) transfer function
> whether the filter can be implemented as FIR or IIR?
> On Thu, May 19, 2011 at 3:34 PM, Syed Ahmar Shah wrote:
>
>> Hi Anas,
>>
>> When you have a transfer function in s/z domain, all you need to do is
>> write the equation in terms of a difference equation and there you go, you
>> get your coefficients. However, the problem here is that, if you are talking
>> about an FIR filter, then the denominator of the transfer function should be
>> 1 which is effectively saying that the output depends only on the current
>> and previous inputs and there is no feedback involved. So assuming you have
>> an FIR filter and the transfer function for it, the numerator is pretty much
>> the coefficients of the FIR filter.
>>
>> Regards,
>> Ahmar
>>
>> On Thu, May 19, 2011 at 2:55 PM, Anas Imtiaz wrote:
>>
>>>
>>>
>>> Hi all,
>>>
>>> I'm trying to implement a low pass filter on a microcontroller, getting
>>> coefficients in MATLAB. I have the transfer function in s-domain, so I am
>>> using bilinear() to get the coefficients. This gives num and den (a and b
>>> coefficients) for an IIR implementation. I would like to know if it possible
>>> to get the coefficients for an FIR implementation of a filter, when you have
>>> the transfer function in s-domain?
>>>
>>> PS. I'm not from a DSP background, so I am not really sure if I am using
>>> the right approach either.
>>>
>>> Thanks
>>>
>>> --
>> Syed Ahmar Shah
>>
>

--
Syed Ahmar Shah
Hi Anas,

When you have a transfer function in s/z domain, all you need to do is write
the equation in terms of a difference equation and there you go, you get
your coefficients. However, the problem here is that, if you are talking
about an FIR filter, then the denominator of the transfer function should be
1 which is effectively saying that the output depends only on the current
and previous inputs and there is no feedback involved. So assuming you have
an FIR filter and the transfer function for it, the numerator is pretty much
the coefficients of the FIR filter.

Regards,
Ahmar

On Thu, May 19, 2011 at 2:55 PM, Anas Imtiaz wrote:

> Hi all,
>
> I'm trying to implement a low pass filter on a microcontroller, getting
> coefficients in MATLAB. I have the transfer function in s-domain, so I am
> using bilinear() to get the coefficients. This gives num and den (a and b
> coefficients) for an IIR implementation. I would like to know if it possible
> to get the coefficients for an FIR implementation of a filter, when you have
> the transfer function in s-domain?
>
> PS. I'm not from a DSP background, so I am not really sure if I am using
> the right approach either.
>
> Thanks
>
>

--
Syed Ahmar Shah