Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

implement filtfilt as transfer function in C++

562 views
Skip to first unread message

Leena

unread,
Nov 24, 2009, 11:01:33 AM11/24/09
to
I have a butterworth low pass filter of order 5, I am using "filtfilt" function to reduce the startup transient. it is working perfectly well. now I need to derive the transfer function for this implementation of this butterworth filter to integrrate the filter in C++ application. is it simlpy the (H(z)*H(1/z)) 10th order transfet function? I tried that and compared the output of each input sample with the output of the filtfilt function but they did not match. what am I missing? and can someone tell me what is the best way to implement it?

appreciate your help

thanks

R vdM

unread,
Nov 25, 2009, 6:52:20 AM11/25/09
to
"Leena " <rula.k...@zimmer.com> wrote in message <heh00t$kak$1...@fred.mathworks.com>...

> I have a butterworth low pass filter of order 5, I am using "filtfilt" function to reduce the startup transient. it is working perfectly well. now I need to derive the transfer function for this implementation of this butterworth filter to integrrate the filter in C++ application. is it simlpy the (H(z)*H(1/z)) 10th order transfet function? I tried that and compared the output of each input sample with the output of the filtfilt function but they did not match. what am I missing? and can someone tell me what is the best way to implement it?
>
> appreciate your help
>
> thanks

Hi,

Kind of the same problem do I have. I need to transfer the functionality of the Matlab's "filtfilt" and indirect its "filter" function to C. The "filtfilt" function puts in some initial states (zi) in the "filter" function leading to a reduce startup transient effects. Therefore the transfer-function is not simply (H(z)*H(1/z)) I guess. But it is unknown to me what is actually done with those zi parameters in the "filter" function.

So if there is somebody who can answer the first question of Leena, I hope that he/she can answer mine as well.

Thanks.

Leena

unread,
Nov 25, 2009, 1:28:04 PM11/25/09
to
I was able to implement it, if you refer to the filtfilt.m file in:
toolbox\signal\signal\
or simply type edit filtfilt.m . it will open the code behind the filtfilt function. it will show you how to estimate the initial conditions (IC's). keep in mind that this is a non-causal filter therefore, it is not possible to run it on line, you need the whole sequnce of samples before you can estimate IC's. also you have to be careful how you apply IC's. the best and simplest way is to use the direct-form II structure. you can refer to:
http://www.mathworks.com/access/helpdesk/help/toolbox/signal/f1-22616.html
to learn how to implement the filter.
good luck

"R vdM" <taaies...@hotmail.com> wrote in message <hej5pk$74l$1...@fred.mathworks.com>...

0 new messages