Thread Subject: implement filtfilt as transfer function in C++

Subject: implement filtfilt as transfer function in C++

From: Leena

Date: 24 Nov, 2009 16:01:33

Message: 1 of 3

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

Subject: implement filtfilt as transfer function in C++

From: R vdM

Date: 25 Nov, 2009 11:52:20

Message: 2 of 3

"Leena " <rula.kiblawi@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.

Subject: implement filtfilt as transfer function in C++

From: Leena

Date: 25 Nov, 2009 18:28:04

Message: 3 of 3

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" <taaiesoepkip@hotmail.com> wrote in message <hej5pk$74l$1@fred.mathworks.com>...
> "Leena " <rula.kiblawi@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.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
initial state R vdM 25 Nov, 2009 06:54:09
filtfilt R vdM 25 Nov, 2009 06:54:09
zi R vdM 25 Nov, 2009 06:54:09
filter R vdM 25 Nov, 2009 06:54:09
filtfilt implem... Leena 24 Nov, 2009 11:04:06
rssFeed for this Thread

Contact us at files@mathworks.com