Hi, I'm trying to specify a DSP system to measure a two sine waves around 100kHz and their resulting harmonics down to the 5th. The phase information is important as well as the magnitude of the harmonics. In order to avoaid any aliasing and phase problems with an analog filter I 'm intending to oversample at 4MSPS. From what I can tell I will then need to perform a low pass FIR before downsampling. My question is in order to keep the phase information from the original signal do I need to perform a complex FIR? I understand the need for a complex FFT in this matter, but does the FIR need to be complex too? If this is the case can anyone suggest a source for a complex FIR routine for a SHARC DSP, the VDSP++ libraries only have real ones. Thanks in advance for the help. Ed _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
Phase in FIR
Started by ●May 21, 2007
Reply by ●May 21, 20072007-05-21
"Edison" <ebell@senscient.com> writes:> Hi, > > I'm trying to specify a DSP system to measure a two sine waves around > 100kHz and their resulting harmonics down to the 5th. > > The phase information is important as well as the magnitude of the > harmonics. > > In order to avoaid any aliasing and phase problems with an analog filter I > 'm intending to oversample at 4MSPS. > > From what I can tell I will then need to perform a low pass FIR before > downsampling. > > My question is in order to keep the phase information from the original > signal do I need to perform a complex FIR?No. You need a linear phase FIR, i.e., one in which the coefficients are either even symmetric or odd symmetric. -- % Randy Yates % "Watching all the days go by... %% Fuquay-Varina, NC % Who are you and who am I?" %%% 919-577-9882 % 'Mission (A World Record)', %%%% <yates@ieee.org> % *A New World Record*, ELO http://home.earthlink.net/~yatescr
Reply by ●May 21, 20072007-05-21
>No. You need a linear phase FIR, i.e., one in which the coefficients are >either even symmetric or odd symmetric.From what I understand a linear phase FIR will still change the relative phase of the harmonics, just in a perdictable fashion. Is this not the case? Also if I can use a linear phase filter does it need to be complex or can I use a real one? Ed _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
Reply by ●May 21, 20072007-05-21
"Edison" <ebell@senscient.com> writes:>>No. You need a linear phase FIR, i.e., one in which the coefficients are >>either even symmetric or odd symmetric. > > From what I understand a linear phase FIR will still change the relative > phase of the harmonics, just in a perdictable fashion. Is this not the > case?All filters change the phase in a predictable fashion. The question is, in what fashion? Linear phase means constant time delay. In other words, the filter delays all frequencies in time equally. Phase distortion happens when different frequencies pass through with different time delays.> Also if I can use a linear phase filter does it need to be complex or can > I use a real one?The issue of whether a filter needs to be complex or not is completely unrelated to whether or not it's linear-phase. -- % Randy Yates % "She's sweet on Wagner-I think she'd die for Beethoven. %% Fuquay-Varina, NC % She love the way Puccini lays down a tune, and %%% 919-577-9882 % Verdi's always creepin' from her room." %%%% <yates@ieee.org> % "Rockaria", *A New World Record*, ELO http://home.earthlink.net/~yatescr
Reply by ●May 21, 20072007-05-21
>Linear phase means constant time delay. In other words, the filter >delays all frequencies in time equally. Phase distortion happens when >different frequencies pass through with different time delays.Sorry to go round the point but I need to get this straight in my head. If the filter adds the same time delay to all frequencies then the relative phase of a higher harmonic will shift upwards. This will then change the realtive phase of the harmonic to the fundamental will it not? _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
Reply by ●May 21, 20072007-05-21
Edison wrote:>> Linear phase means constant time delay. In other words, the filter >> delays all frequencies in time equally. Phase distortion happens when >> different frequencies pass through with different time delays. > > Sorry to go round the point but I need to get this straight in my head. > > If the filter adds the same time delay to all frequencies then the > relative phase of a higher harmonic will shift upwards. This will then > change the realtive phase of the harmonic to the fundamental will it not?Suppose you have two identical CDs in two identical CD players. Start one, then after a delay, start the other. The phase relations of one to the other depend on the delay *and on the frequency*, but the internal phase relations of each are the same. You can play one next week, and the phase relations still won't have changed. Pure delay doesn't change relative phase. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●May 21, 20072007-05-21
Edison wrote:> Hi, > > I'm trying to specify a DSP system to measure a two sine waves around > 100kHz and their resulting harmonics down to the 5th. > > The phase information is important as well as the magnitude of the > harmonics. > > In order to avoaid any aliasing and phase problems with an analog filter I > 'm intending to oversample at 4MSPS.Aliasing is your friend :-). If you know the (lowest) frequency of your periodic signal (having several harmonics this signal won't be a sine wave), you can sample at almost any frequency you like, and still extract the full information of the periodic signal. Best is some sampling frequency that is irrational with the frequencies of your periodic signals. You can easily calculate the amplitude and the phase of the harmonics of your periodic test signals (given that you know their period) from the aliases. I would suggest Goertzel algorithm to exctract the 5 amplitude/phase pairs. Remember that every alias-wrap-around introduces a 180=B0 phase shift. Regards, Andor
Reply by ●May 21, 20072007-05-21
On Mon, 21 May 2007 09:59:23 -0700, Andor wrote:> Edison wrote: >> Hi, >> >> I'm trying to specify a DSP system to measure a two sine waves around >> 100kHz and their resulting harmonics down to the 5th. >> >> The phase information is important as well as the magnitude of the >> harmonics. >> >> In order to avoaid any aliasing and phase problems with an analog filter I >> 'm intending to oversample at 4MSPS. > > Aliasing is your friend :-). If you know the (lowest) frequency of > your periodic signal (having several harmonics this signal won't be a > sine wave), you can sample at almost any frequency you like, and still > extract the full information of the periodic signal. Best is some > sampling frequency that is irrational with the frequencies of your > periodic signals. > > You can easily calculate the amplitude and the phase of the harmonics > of your periodic test signals (given that you know their period) from > the aliases. I would suggest Goertzel algorithm to exctract the 5 > amplitude/phase pairs. Remember that every alias-wrap-around > introduces a 180° phase shift. > > Regards, > AndorThis undersampling trick is cool, but only applies if you can be sure that the signal shape doesn't change quickly over time -- if you're looking for harmonic distortion with a known input in the lab it's great. If you're out in the field and there's transients -- it's not so great. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply by ●May 21, 20072007-05-21
On Mon, 21 May 2007 09:23:27 -0500, Edison wrote:> Hi, > > I'm trying to specify a DSP system to measure a two sine waves around > 100kHz and their resulting harmonics down to the 5th. > The phase information is important as well as the magnitude of the > harmonics. > > In order to avoaid any aliasing and phase problems with an analog filter I > 'm intending to oversample at 4MSPS. > From what I can tell I will then need to perform a low pass FIR before > downsampling. > > My question is in order to keep the phase information from the original > signal do I need to perform a complex FIR? I understand the need for a > complex FFT in this matter, but does the FIR need to be complex too? > > If this is the case can anyone suggest a source for a complex FIR routine > > for a SHARC DSP, the VDSP++ libraries only have real ones.A complex FIR filter would only make sense if you were receiving the signal in quadrature -- without that you're pretty much in the real domain anyway. As has been explained, a linear-phase filter will delay the whole signal consistently, so what comes out of the filter will be lined up the same as what went in, with only the amplitudes of the components changed. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply by ●May 21, 20072007-05-21
"Edison" <ebell@senscient.com> wrote in message news:HaOdndg1ediVWMzbnZ2dnUVZ_jKdnZ2d@giganews.com...> If the filter adds the same time delay to all frequencies then the > relative phase of a higher harmonic will shift upwards. This will then > change the realtive phase of the harmonic to the fundamental will it not?I'm saying this without any sort of arrogance, but unfortunately people tend to think that DSP is some sort of magic that happens beyond the rule of physics and that's why weird questions are usually originated. The term "time delay" is ambiguous, what we have here is a group delay indicating how energy is delayed in passing through the filter and a phase delay that indicates how much a certain frequency is phase delayed. The group delay is represented by the first order derivative of the phase with respect to the angular frequency and for a filter with a linear phase response, the energy passes through with a delay that doesn't depend on the angular frequency. So what happens? Using the linearity itself or getting back from the differential equation implied by the derivative, one can see that what's also constant is the ratio between the phase and the angural frequency or to put it differently the phase-shift period product. This means that for the energy to propagate "coherently" what has to happen is that tones at different frequencies are shifted in phase of quantities that are different from each other but that represent the same entity once normalized with respect to the frequency. If your input signal is s(t) = cos(2 * \pi * 10^3 * t) + cos(2 * \pi * 10^4 * t) and the phase shift that the first tone will undergo to is, let's say, -0.1 * \pi, for the energy to propagate coherently the second tone will have to undergo not to a shift of -0.1 * \pi but to a shift of -\pi. The ammounts -0.1 * \pi and -\pi, that here are just an example, in a real filter are clearly the proper ones so that the output at time t = d, where d is the group delay, has exactly the same phase the input had at t = 0. I hope it's clear now, kl31n