Hello, I have a newbie question again on phase of signal. I want to know more on filtering signal with preserving phase information. When is it important to preserve the phase information of a signal and how do we do it using digital FIR filter? I am working on Matlab for my application, but would it be possible to do "zero-phase" filtering in real time system such as FPGA? Could you give me some reference please? Thanks! Thomas
filtering narrow-band signal preserving phase information
Started by ●November 30, 2012
Reply by ●November 30, 20122012-11-30
On Fri, 30 Nov 2012 10:20:01 -0600, gongdori wrote:> Hello, > > I have a newbie question again on phase of signal. > I want to know more on filtering signal with preserving phase > information. > > When is it important to preserve the phase information of a signal and > how do we do it using digital FIR filter? I am working on Matlab for my > application, but would it be possible to do "zero-phase" filtering in > real time system such as FPGA? > Could you give me some reference please? > Thanks!Without knowing what you mean by "zero-phase" filtering, it is impossible to answer that part of your question. Can you filter a signal while preserving phase _information_? Yes, easily -- just use a symmetric FIR filter. Can you filter _any_ signal while maintaining zero phase shift? No, not in this real world we live in. When you filter a signal with a causal* filter, _at minimum_ the phase shift in the frequency domain will be equal to the Hilbert transform of the magnitude response (or log magnitude? I can't remember). You can only get worse from there. Filtering with a symmetric FIR will give you more phase lag, but will give you dead-constant time delay, without any frequency-dependent delays. This meets your "preserve phase information" criteria quite nicely, but I'm not sure if it gets you what you want. If you want to go further, you may want to tell us what you're actually trying to do, instead of picking out one part of it for independent inspection. * "causal filter" means that the filter does not look ahead in time -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●November 30, 20122012-11-30
>Hello, > >I have a newbie question again on phase of signal. >I want to know more on filtering signal with preserving phaseinformation.> >When is it important to preserve the phase information of a signal andhow>do we do it using digital FIR filter? I am working on Matlab for my >application, but would it be possible to do "zero-phase" filtering inreal>time system such as FPGA? >Could you give me some reference please? >Thanks! > >Thomas >Are you aware of Matlab function called "filtfilt"? It filters signal then reverses the filtered stream and filters it again in same filter. Result is "zero phase" change. How can you translate that to real world, I don't know but you will need to break the stream into chunks, store it and restitch it. Kadhiem
Reply by ●November 30, 20122012-11-30
>Hello, > >I have a newbie question again on phase of signal. >I want to know more on filtering signal with preserving phaseinformation.> >When is it important to preserve the phase information of a signal andhow>do we do it using digital FIR filter? I am working on Matlab for my >application, but would it be possible to do "zero-phase" filtering inreal>time system such as FPGA? >Could you give me some reference please? >Thanks! > >Thomas >Also note that phase is preserved if your filter response is linear as pointed out to you by Tim. Thus it is no different from effect of any delay e.g. through piece of wire. Kadhiem
Reply by ●November 30, 20122012-11-30
>>Hello, >> >>I have a newbie question again on phase of signal. >>I want to know more on filtering signal with preserving phase >information. >> >>When is it important to preserve the phase information of a signal and >how >>do we do it using digital FIR filter? I am working on Matlab for my >>application, but would it be possible to do "zero-phase" filtering in >real >>time system such as FPGA? >>Could you give me some reference please? >>Thanks! >> >>Thomas >> > >Also note that phase is preserved if your filter response is linear as >pointed out to you by Tim. Thus it is no different from effect of anydelay>e.g. through piece of wire. > >Kadhiem >Thank you so much, Tim and Kadhiem. What I am trying to do is filtering everything but a narrow band frequency hopping signal with preserving phase info of every burst and I'm doing it in Matlab. After I read the replies, I dig up some text books which talks about group delay and phase delay. Please correct me if I am wrong. :) Since my filter is linear phase, I have fixed number of group delay. If I have N+1 tap "Type I" filter, which is symmetric and odd tap, I would get N/2 group delay. Thus, that is the number of initial samples I need to throw out when I compute the filter output... Is that correct? Also, the group delay of the filter would be the same at all frequency, I can apply what I mentioned to all frequency channels...right?
Reply by ●November 30, 20122012-11-30
On 11/30/12 11:55 AM, Tim Wescott wrote:> On Fri, 30 Nov 2012 10:20:01 -0600, gongdori wrote: > >> Hello, >> >> I have a newbie question again on phase of signal. >> I want to know more on filtering signal with preserving phase >> information. >> >> When is it important to preserve the phase information of a signal and >> how do we do it using digital FIR filter? I am working on Matlab for my >> application, but would it be possible to do "zero-phase" filtering in >> real time system such as FPGA?someone else mentioned FILTFILT. there *is* a method of doing FILTFILT real-time, but it seems to me to be a pretty complicated mess in an FPGA. you have to break the input into frames and filter each frame frontwards and backwards but you also have to do overlap-add. there is an IEEE paper by Powell and Chau: http://users.cosylab.com/~msekoranja/tmp/00097998.pdf some other paper about it http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=324751 and Avery Wang and Julius Smith came up with this idea of "Truncated" IIR filters which is a way to do this correctly, theoretically (powell & chau do not use truncated IIR filters, so there is a theoretical problem).>> Could you give me some reference please? >> Thanks! > > Without knowing what you mean by "zero-phase" filtering, it is impossible > to answer that part of your question.zero-phase filtering is linear-phase filtering with zero delay. of course that cannot be strictly done in real time (except for the trivial wire or wire-with-gain) because a symmetrical h[n] that is centered about n=0 is non-causal. with the right adjustment of offset, FILTFILT is zero-phase filtering so, with file processing (where you can look ahead to "future" samples) zero-phase filtering is possible. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●December 1, 20122012-12-01
>What I am trying to do is filtering everything but a narrow bandfrequency>hopping signal with preserving phase info of every burst and I'm doing it >in Matlab. >After I read the replies, I dig up some text books which talks aboutgroup>delay and phase delay. Please correct me if I am wrong. :) > >Since my filter is linear phase, I have fixed number of group delay. If I >have N+1 tap "Type I" filter, which is symmetric and odd tap, I would get >N/2 group delay. Thus, that is the number of initial samples I need to >throw out when I compute the filter output... Is that correct? >Also, the group delay of the filter would be the same at all frequency, I >can apply what I mentioned to all frequency channels...right? >Yes for symmetric fir, group delay = order/2 (order = taps -1) It is fixed constant for all frequencies if your fir filter is symmetric. It represents a fixed time delay just like a piece of wire say delaying a signal by few nano seconds. This wire delay will change phase but in a linear way. Kadhiem
Reply by ●December 2, 20122012-12-02
On Fri, 30 Nov 2012 19:34:49 -0500, robert bristow-johnson wrote:> On 11/30/12 11:55 AM, Tim Wescott wrote: >> On Fri, 30 Nov 2012 10:20:01 -0600, gongdori wrote: >> >>> Hello, >>> >>> I have a newbie question again on phase of signal. I want to know more >>> on filtering signal with preserving phase information. >>> >>> When is it important to preserve the phase information of a signal and >>> how do we do it using digital FIR filter? I am working on Matlab for >>> my application, but would it be possible to do "zero-phase" filtering >>> in real time system such as FPGA? > > someone else mentioned FILTFILT. > > there *is* a method of doing FILTFILT real-time, but it seems to me to > be a pretty complicated mess in an FPGA. you have to break the input > into frames and filter each frame frontwards and backwards but you also > have to do overlap-add. > > there is an IEEE paper by Powell and Chau: > > http://users.cosylab.com/~msekoranja/tmp/00097998.pdf > > some other paper about it > > http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=324751 > > and Avery Wang and Julius Smith came up with this idea of "Truncated" > IIR filters which is a way to do this correctly, theoretically (powell & > chau do not use truncated IIR filters, so there is a theoretical > problem). > >>> Could you give me some reference please? Thanks! >> >> Without knowing what you mean by "zero-phase" filtering, it is >> impossible to answer that part of your question. > > zero-phase filtering is linear-phase filtering with zero delay. of > course that cannot be strictly done in real time (except for the trivial > wire or wire-with-gain) because a symmetrical h[n] that is centered > about n=0 is non-causal. > > with the right adjustment of offset, FILTFILT is zero-phase filtering > so, with file processing (where you can look ahead to "future" samples) > zero-phase filtering is possible.I'm too immersed in control systems: the notion of zero delay across the board just got shoved into the "can't be done" pigeon hole, without remembering my DSP terminology. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by ●December 2, 20122012-12-02
On 12/2/12 2:39 PM, Tim Wescott wrote:> On Fri, 30 Nov 2012 19:34:49 -0500, robert bristow-johnson wrote: > >> On 11/30/12 11:55 AM, Tim Wescott wrote: >>> On Fri, 30 Nov 2012 10:20:01 -0600, gongdori wrote: >>> >>>> Hello, >>>> >>>> I have a newbie question again on phase of signal. I want to know more >>>> on filtering signal with preserving phase information. >>>> >>>> When is it important to preserve the phase information of a signal and >>>> how do we do it using digital FIR filter? I am working on Matlab for >>>> my application, but would it be possible to do "zero-phase" filtering >>>> in real time system such as FPGA? >> >> someone else mentioned FILTFILT. >> >> there *is* a method of doing FILTFILT real-time, but it seems to me to >> be a pretty complicated mess in an FPGA. you have to break the input >> into frames and filter each frame frontwards and backwards but you also >> have to do overlap-add. >> >> there is an IEEE paper by Powell and Chau: >> >> http://users.cosylab.com/~msekoranja/tmp/00097998.pdf >> >> some other paper about it >> >> http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=324751 >> >> and Avery Wang and Julius Smith came up with this idea of "Truncated" >> IIR filters which is a way to do this correctly, theoretically (powell& >> chau do not use truncated IIR filters, so there is a theoretical >> problem). >> >>>> Could you give me some reference please? Thanks! >>> >>> Without knowing what you mean by "zero-phase" filtering, it is >>> impossible to answer that part of your question. >> >> zero-phase filtering is linear-phase filtering with zero delay. of >> course that cannot be strictly done in real time (except for the trivial >> wire or wire-with-gain) because a symmetrical h[n] that is centered >> about n=0 is non-causal. >> >> with the right adjustment of offset, FILTFILT is zero-phase filtering >> so, with file processing (where you can look ahead to "future" samples) >> zero-phase filtering is possible. > > I'm too immersed in control systems: the notion of zero delay across the > board just got shoved into the "can't be done" pigeon hole, without > remembering my DSP terminology. >you're thinking about real, physical realizable systems doing useful things in real time interacting with other real components. FILTFILT is a file processing program. as such, the "present" sample is a conceptual construct (it's the sample that your "present sample" pointer is pointing to). there is no problem with looking ahead to "future" samples. or even to run time backwards. i was talking about this sorta at the last AES and the way i put it is, in Unreal-Time processing (that is processing sound files to sound files), you get to sorta play God with time. run it forward slow or fast, run it backwards, take a piece of time from here, another piece of time from there (sometimes we call these little pieces "grains"). it's like time is just another spacial dimension and you get to look at the timescape of the file like landscape. of course, in a physically realizable real-time system, you cannot see future samples and the impulse response must be causal and you cannot do zero-phase filtering except for a simple gain applied to the present sample x[n]. if there are any past samples in the mix, you have no future samples to balance them with, so there can't be any past samples in a real-time zero-phase filter. when you use the concept of FILTFILT in a real time system using the Powell/Chau technique, it actually has quite a bit of delay to do the necessary buffering and framing. so it's not really zero-phase, but a linear phase system. it's a true FIR if, instead of using a regular IIR filter (forward and backward, like in FILTFILT) if you use Truncated IIR filters (similar to the Wang and Smith idea). -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●December 2, 20122012-12-02
�i was talking about> this sorta at the last AES and the way i put it is, in Unreal-Time > processing (that is processing sound files to sound files), you get to > sorta play God with time. �run it forward slow or fast, run it > backwards, take a piece of time from here, another piece of time from > there (sometimes we call these little pieces "grains"). �it's like time > is just another spacial dimension and you get to look at the timescape > of the file like landscape.it's funny you mention that, i think that IS how God "sees" existence. God can view time like in an audio editor, all of time is there right before him (or her). Just like we can see space to the left and space to the right, he can see time before and time after all at the same um time. Mark






