# Phase in FIR

Started by May 21, 2007
```On 21 May, 18:12, "Edison" <e...@senscient.com> 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.

Yes.

> This will then
> change the realtive phase of the harmonic to the fundamental will it not?

No. In a linear-phase system the funcamental will have
changed phase, too. The net effect of adding a linear
phase shift is to shift the signal in time.

FT{x(t)} = integral x(t) exp(jwt) dt

FT{x(t-T)} = integral x(t-T) exp(jwt)dt

t-T = p => t = p+T,   dp/dt = 1 => dt = dp

FT{x(t-T)} = integral x(p) exp(jw(p+T)) dp
(p = t)
= exp(jwT) integral x(t)exp(jwt) dt
= exp(jwT)FT{x(t)}

and as you can see, the phase term wT is linear
with frequency.

Rune

```
```Rune Allnor wrote:

...

>     In a linear-phase system the fundamental will have
> changed phase, too. The net effect of adding a linear
> phase shift is to shift the signal in time.

That might be a confusing way to put it. What we call a linear-phase
filter changes the phase of each component an ampunt proportional to its
frequency. That is precisely equivalent to a time delay that is
independent of frequency. Viewed in time, the signal is merely "moved
over". The same thing happens when a signal propagates in a medium at a
finite speed. The relative phases of the components of an FM broadcast
don't depend on the distance between transmitter and receiver.

...

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```On 21 Mai, 22:29, Tim Wescott <t...@seemywebsite.com> wrote:
> 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 filt=
er 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
>
> This 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.

Well, the trick only applies to measurement of periodic signals (in
the lab or in the field, doesn't matter).

All we need to know is the period and the number of harmonics present
in the signal (an upper bound could be guaranteed by a continuous-time
lowpass filter prior to sampling).

The amplitudes / phases of the harmonics can be extracted by a linear
set of equations (which is simpler than Goertzel which I suggested in
the previous post). In the presence of measurement noise, the linear
set of equations can easily be updated with additional measurements
and solved in, for example, the least-squares sense. I think this
trick could really be used in practice.

Regards,
Andor

```
```On 21 May, 23:23, Jerry Avins <j...@ieee.org> wrote:
> Rune Allnor wrote:
>
>    ...
>
> >     In a linear-phase system the fundamental will have
> > changed phase, too. The net effect of adding a linear
> > phase shift is to shift the signal in time.
>
> That might be a confusing way to put it.

Is it? Why? The question was clear enough, paraphrased
as I interpreted it: Does the different added phase
terms between frequency components distort the signal.

I don't think my answer above is wrong? Maybe if we
include the DC component, but I don't want to get into
one of those "what is the phase of DC" wars...

Rune

```
```"kl31n" <kl31n(get rid of this to write me back)@hotmail.com> writes:
> [...]
> 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.

That's like saying "differential equations is some sort of magic that
happens beyond the rule of physics." Well, it does happen beyond the
rule of physics, in that domain called "mathematics." It just so
happens that many physical things are modeled by differential
equations, but that doesn't make them physical. Same with DSP.

> The term "time delay" is ambiguous

Assuming that the independent variable is time and we know the sample
rate [1], time delay is absolutely precise and well-defined when
discussing a linear phase digital filter, and all that is required to

--Randy

[1] Otherwise we would need to use the term "sample delay."
--
%  Randy Yates                  % "Bird, on the wing,
%% Fuquay-Varina, NC            %   goes floating by
%%% 919-577-9882                %   but there's a teardrop in his eye..."
%%%% <yates@ieee.org>           % 'One Summer Dream', *Face The Music*, ELO
```
```Andor wrote:
> On 21 Mai, 22:29, Tim Wescott <t...@seemywebsite.com> wrote:
>> 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&#65533; phase shift.
>>> Regards,
>>> Andor
>> This 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.
>
> Well, the trick only applies to measurement of periodic signals (in
> the lab or in the field, doesn't matter).
>
> All we need to know is the period and the number of harmonics present
> in the signal (an upper bound could be guaranteed by a continuous-time
> lowpass filter prior to sampling).
>
> The amplitudes / phases of the harmonics can be extracted by a linear
> set of equations (which is simpler than Goertzel which I suggested in
> the previous post). In the presence of measurement noise, the linear
> set of equations can easily be updated with additional measurements
> and solved in, for example, the least-squares sense. I think this
> trick could really be used in practice.

If the period is known, then reducing all measurement times
modulo(period) Eliminates almost all other computation. Consider a
sampling scope. (Juan Amodei dreamed that up around 1960.)

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```Rune Allnor wrote:
> On 21 May, 23:23, Jerry Avins <j...@ieee.org> wrote:
>> Rune Allnor wrote:
>>
>>    ...
>>
>>>     In a linear-phase system the fundamental will have
>>> changed phase, too. The net effect of adding a linear
>>> phase shift is to shift the signal in time.
>> That might be a confusing way to put it.
>
> Is it? Why? The question was clear enough, paraphrased
> as I interpreted it: Does the different added phase
> terms between frequency components distort the signal.
>
> I don't think my answer above is wrong? Maybe if we
> include the DC component, but I don't want to get into
> one of those "what is the phase of DC" wars...

What you wrote isn't wrong. I think it might be open to more than one
interpretation. If I'm wrong, what's the harm?

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```"Randy Yates" <yates@ieee.org> wrote in message
news:m3fy5piz3z.fsf@ieee.org...
> "kl31n" <kl31n(get rid of this to write me back)@hotmail.com> writes:
>> [...]
>> 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.

> That's like saying "differential equations is some sort of magic that
> happens beyond the rule of physics." Well, it does happen beyond the
> rule of physics, in that domain called "mathematics." It just so
> happens that many physical things are modeled by differential
> equations, but that doesn't make them physical. Same with DSP.

I get your point, but that's not quite what I meant. My intention is simply
to underline that when the model tries to describe something physical - and
DSP does - it's often useful to discern the correctness of the results that
one can get out of the model crosschecking them against their physical
meaning.

>> The term "time delay" is ambiguous
>
> Assuming that the independent variable is time and we know the sample
> rate [1], time delay is absolutely precise and well-defined when
> discussing a linear phase digital filter, and all that is required to

What's the definition of something ambiguous? Something that needs
assumptions to be interpreted. :)
Given the OP's message to which I answered, it was my understanding that he
was confused just about how the constant group delay influenced the phase
delay and that's where I came in. It wasn't my intention to criticize the
expression "time delay", which, as you say, is legitimate, but to move the
OP's attention on the phase delay with respect to the group delay.

Best regards,

kl31n

```
```glen herrmannsfeldt wrote:
> Randy Yates wrote:
> (snip)
>
>> Assuming that the independent variable is time and we know the sample
>> rate [1], time delay is absolutely precise and well-defined when
>> discussing a linear phase digital filter, and all that is required to
>
> Since you already put physics into the discussion, remember that
> time delay is reference frame dependent.

:-) I suppose it is safe to assume that input and output ports have zero
relative velocity.

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```Randy Yates wrote:
(snip)

> Assuming that the independent variable is time and we know the sample
> rate [1], time delay is absolutely precise and well-defined when
> discussing a linear phase digital filter, and all that is required to