# Basics of Frequency Shifting

Started by November 5, 2008
```Can someone refer me to a source of basic information on frequency shifting?
I have an audio frequency input tone consisting of a single relatively
stable signal that is in the range of 5 kHz +/- 5 Hz.  I want the circuit to
shift the tone to precisely 5 kHz.

I have limited DSP knowledge so if someone could point me at some basic
reference info that would be a great help.

```
```Question: After the frequency shift, what do you want to do? Do you
want to look at the time signal after the frequency shift, or the
frequency spectrum after the frequency shift?

James
www.go-ci.com

```
```At the time spectrum.  Specifically, I'm interested in the phase of the
shifted signal.

Mason

"DigitalSignal" <digitalsignal999@yahoo.com> wrote in message
> Question: After the frequency shift, what do you want to do? Do you
> want to look at the time signal after the frequency shift, or the
> frequency spectrum after the frequency shift?
>
> James
> www.go-ci.com
>

```
```Here is what I would do:

take the original signal, x(t), multiply it by: cos(2 PI dF t), sin(2
PI dF t)

R(t) = x(t) cos(2 PI dF t)
I(t) = x(t) sin(2 PI dF t)

where dF is the delta frequency to be shifted.

Now you have two time series signals: R(t) and I(t).

Conduct complex Fourier transform using R(t) as real and I(t) as
imaginary parts. The results will be frequency shifted spectrum.

James
www.go-ci.com
```
```>Can someone refer me to a source of basic information on frequency
shifting?
>I have an audio frequency input tone consisting of a single relatively
>stable signal that is in the range of 5 kHz +/- 5 Hz.  I want the circuit
to
>shift the tone to precisely 5 kHz.

If you have no other signal than this tone, you can find its amplitude as
a function of time, and multiply (mix) that by a "pure sine".   You can
achieve this by filtering the signal first.  In simplest terms, you could
design an RC-circuit to get the envelope of the signal and mix that with
the purer tone.

What is your application?  What is the tone?

Emre
```
```OK, that's possible if I first determine the amount of shift I need by
measurement of the input frequency.

What I need is simpler though.  All that I need to do is to AFC the signal -
that is, shift it to a constant frequency (5 kHz in my example).

Can you suggest a simple way to do that?

Thank you.

Mason

"DigitalSignal" <digitalsignal999@yahoo.com> wrote in message
> Here is what I would do:
>
> take the original signal, x(t), multiply it by: cos(2 PI dF t), sin(2
> PI dF t)
>
> R(t) = x(t) cos(2 PI dF t)
> I(t) = x(t) sin(2 PI dF t)
>
> where dF is the delta frequency to be shifted.
>
> Now you have two time series signals: R(t) and I(t).
>
> Conduct complex Fourier transform using R(t) as real and I(t) as
> imaginary parts. The results will be frequency shifted spectrum.
>
> James
> www.go-ci.com

```
```The input signal is essentially a pure tone as it is received, at approx but
not exactly 5 kHz.  I don't follow what you mean by mixing it with a pure
sine.  My goal is to shift (mix) it to precisely 5 kHz, always 5 kHz, like
an AFC circuit.

The application is to determine the difference in phase shift through two
circuits driven by separate oscillators.  Since the oscillators have
slightly different frequencies I first need to normalize the frequencies
then measure the phase difference between the signals.

Mason

"emre" <eguven@ece.neu.edu> wrote in message
news:87SdnQBupffs04_UnZ2dnUVZ_hGdnZ2d@giganews.com...
> >Can someone refer me to a source of basic information on frequency
> shifting?
>>I have an audio frequency input tone consisting of a single relatively
>>stable signal that is in the range of 5 kHz +/- 5 Hz.  I want the circuit
> to
>>shift the tone to precisely 5 kHz.
>
> If you have no other signal than this tone, you can find its amplitude as
> a function of time, and multiply (mix) that by a "pure sine".   You
can
> achieve this by filtering the signal first.  In simplest terms, you could
> design an RC-circuit to get the envelope of the signal and mix that with
> the purer tone.
>
> What is your application?  What is the tone?
>
> Emre

```
```Jason wrote:
> OK, that's possible if I first determine the amount of shift I need by
> measurement of the input frequency.
>
> What I need is simpler though.  All that I need to do is to AFC the signal -
> that is, shift it to a constant frequency (5 kHz in my example).
>
> Can you suggest a simple way to do that?

You might find what you need at http://www.dspdimension.com/

You mentioned wanting to compare phase. Compare t5o what?

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Mason wrote:

...

> The application is to determine the difference in phase shift through two
> circuits driven by separate oscillators.  Since the oscillators have
> slightly different frequencies I first need to normalize the frequencies
> then measure the phase difference between the signals.

Give up. Frequency can be looked at as rate of change of phase. You
can't measure phase shift of signals at different frequencies.Arrange to
use a single oscillator, even if it seems too complicated.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```On Nov 5, 6:06&#2013266080;pm, "Mason" <plsnos...@plsnospam.net>
wrote:
> The input signal is essentially a pure tone as it is received, at approx but
> not exactly 5 kHz. &#2013266080;I don't follow what you mean by mixing it
with a pure
> sine. &#2013266080;My goal is to shift (mix) it to precisely 5 kHz, always
5 kHz, like
> an AFC circuit.
>
> The application is to determine the difference in phase shift through two
> circuits driven by separate oscillators. &#2013266080;Since the oscillators
have
> slightly different frequencies I first need to normalize the frequencies
> then measure the phase difference between the signals.
>
> Mason
>
> "emre" <egu...@ece.neu.edu> wrote in message
>
> news:87SdnQBupffs04_UnZ2dnUVZ_hGdnZ2d@giganews.com...
>
>
>
> > >Can someone refer me to a source of basic information on frequency
> > shifting?
> >>I have an audio frequency input tone consisting of a single relatively
> >>stable signal that is in the range of 5 kHz +/- 5 Hz.
&#2013266080;I want the circuit
> > to
> >>shift the tone to precisely 5 kHz.
>
> > If you have no other signal than this tone, you can find its amplitude as
> > a function of time, and multiply (mix) that by a "pure sine".
&#2013266080; You can
> > achieve this by filtering the signal first. &#2013266080;In simplest
terms, you could
> > design an RC-circuit to get the envelope of the signal and mix that with
> > the purer tone.
>
> > What is your application? &#2013266080;What is the tone?
>
> > Emre- Hide quoted text -
>
> - Show quoted text -

Jerry is right. You can't compare the phase between the two sines from
two oscillators unless they are somehow correlated. Maybe we did not

James
www.go-ci.com
```
```>Glen Herrmannsfeldt wrote:
>> Jerry Avins wrote:
>>> Glen Herrmannsfeldt wrote:
>>
>>>> That works if the signals are the same source with different
delay,
>>>> as it now sounds like you have.
>>
>>> If the frequencies of the sources differ, how can they be the *same*
>>> source?
>>
>> The OP isn't giving the details, but it sounds like it might
>> be one signal with variable delay.  If the frequency of the source
>> varies with time, then delayed versions can have different frequencies
>> (at the time they arrive).
>
>He wrote that independent oscillators are in different locations. I
>don't see how to attach more than arm-waving significance to "phase
>comparison".

Would these arms be waving in a clock-face like manner to indicate phase?
:-\

Steve

```
```Glen Herrmannsfeldt wrote:
> Jerry Avins wrote:
>> Glen Herrmannsfeldt wrote:
>
>>> That works if the signals are the same source with different delay,
>>> as it now sounds like you have.
>
>> If the frequencies of the sources differ, how can they be the *same*
>> source?
>
> The OP isn't giving the details, but it sounds like it might
> be one signal with variable delay.  If the frequency of the source
> varies with time, then delayed versions can have different frequencies
> (at the time they arrive).

He wrote that independent oscillators are in different locations. I
don't see how to attach more than arm-waving significance to "phase
comparison".

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Jerry Avins wrote:
> Glen Herrmannsfeldt wrote:

>> That works if the signals are the same source with different delay,
>> as it now sounds like you have.

> If the frequencies of the sources differ, how can they be the *same*
> source?

The OP isn't giving the details, but it sounds like it might
be one signal with variable delay.  If the frequency of the source
varies with time, then delayed versions can have different frequencies
(at the time they arrive).

-- glen

```
```On Sat, 08 Nov 2008 11:08:19 -0500, Jerry Avins <jya@ieee.org> wrote:

>Glen Herrmannsfeldt wrote:
>
>   ...
>
>> That works if the signals are the same source with different delay,
>> as it now sounds like you have.
>
>If the frequencies of the sources differ, how can they be the *same* source?
>
>Jerry

Different doppler?

In the radio astronomy case I could see that the earth's rotation
could create a situation where one antenna is moving toward the
emitter and one away.  The emitted frequency is the same.

But if there's no Doppler, then, yeah...??

Eric Jacobsen
Minister of Algorithms
Abineau Communications
http://www.ericjacobsen.org

Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
```
```Glen Herrmannsfeldt wrote:

...

> That works if the signals are the same source with different delay,
> as it now sounds like you have.

If the frequencies of the sources differ, how can they be the *same* source?

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```On Nov 8, 12:22&#2013266080;am, Glen Herrmannsfeldt
<g...@ugcs.caltech.edu> wrote:
> Mason wrote:
> > I have no control over the sources. &#2013266080;The two sines are
correlated in that I
> > know their relative phase at a specific time at the sources.
&#2013266080;They are at
> > slightly different frequencies and arriving through two circuits with
> > different delays. &#2013266080;I'm measuring the difference in time
between selected
> > events in the two sines - ie, waveform maxima - to determine the
difference
> > in the circuit delays, and I'm making that measurement at about the same
> > time when I know their relative phase at the sources.
> > The problem is, errors in the time of measurement cause inaccurate
> > measurement results because the waveforms are moving relative to each
other
> > vs. time as a result of their different frequencies.
>
> Look at what Radio-Astronomy people do, which is very similar to
> what you say. &#2013266080;They receive a signal at different places around
the
> world and combine them, including phase, to reconstruct as if received
> by an earth-sized antenna.
>
> That works if the signals are the same source with different delay,
> as it now sounds like you have.
>
> -- glen

Write the 2 inputs at 2 different frequencies as

cos(w1*t)

and

cos(w2*t + ipo)

where w1 and w2 are the source frequencies and ipo stands for "initial
phase offset" (phase offset valid at time 0).

Now add 2 different delay terms d1 and d2

out1 = cos(w1*(t - d1))
out2 = cos(w2*(t - d2) + ipo)

Lets assume you can measure w1 and w2 exactly at the output (there are
some problems here, aslo, but I'll ignore those for now).

So you have 2 equations and 3 unknowns (d1, d2, ipo). If there was a
"time 0" event where you knew the sources started at a known phase (so
"ipo" becomes known), then you could solve these equations for d1 and
d2 by making a measurement at a known time t, but you would have the
furthur problem that ANY drift of w1 or w2 relative (starting from
time 0), or any measurement error of w1 and w2, would cause an
accumulating error over time that would eventually become significant.

```
```Mason wrote:

> I have no control over the sources.  The two sines are correlated in that I
> know their relative phase at a specific time at the sources.  They are at
> slightly different frequencies and arriving through two circuits with
> different delays.  I'm measuring the difference in time between selected
> events in the two sines - ie, waveform maxima - to determine the difference
> in the circuit delays, and I'm making that measurement at about the same
> time when I know their relative phase at the sources.

> The problem is, errors in the time of measurement cause inaccurate
> measurement results because the waveforms are moving relative to each other
> vs. time as a result of their different frequencies.

Look at what Radio-Astronomy people do, which is very similar to
what you say.  They receive a signal at different places around the
world and combine them, including phase, to reconstruct as if received
by an earth-sized antenna.

That works if the signals are the same source with different delay,
as it now sounds like you have.

-- glen

```
```On Wed, 05 Nov 2008 21:28:09 -0500, Jerry Avins wrote:

> Mason wrote:
>
>    ...
>
>> The application is to determine the difference in phase shift through
>> two circuits driven by separate oscillators.  Since the oscillators
>> have slightly different frequencies I first need to normalize the
>> frequencies then measure the phase difference between the signals.
>
> Give up. Frequency can be looked at as rate of change of phase. You
> can't measure phase shift of signals at different frequencies.Arrange to
> use a single oscillator, even if it seems too complicated.
>
> Jerry

That pretty much sums it up.  Any pair of oscillators that aren't coupled
will have independent phases, even if their frequencies are very close.
So the only way that you could measure the phase shift imposed by two
different circuits driven by two different oscillators, or even the
difference in that phase shift, would be to measure the circuits'
outputs' phases against the oscillators' phases, i.e. you'd need to take
four measurements.

So unless you use one oscillator, or two locked oscillator, you're out of
luck.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it
says.
See details at http://www.wescottdesign.com/actfes/actfes.html
```
```On Thu, 6 Nov 2008 08:02:39 -0800, Mason <plsnospam@plsnospam.net> wrote:
> The problem is unusual in that I don't have physical access to either the
> sources or the circuit inputs.  They are remote.  I am stuck with having two
> independent sources at slightly different frequencies arriving via
> independent circuits with different delays.  What I do know is the relative
> signal phases at the sources at a specific time.
>
> So one way to determine differential circuit delay is to measure relative
> phase of the arriving signals at the same time when the relative phases are
> known at the sources.  However this is subject to errors in measurement
> time.
>
> I'm trying to reduce or eliminate sensitivity to time of measurement by
> shifting both received signals to a common frequency.  The shifting process
> may alter the signal phases, but it should do the same to both circuits
> thereby not affecting the relative received phases that I want to measure.
> Conceptually is there a flaw in this approach?

Mason,

I seem to have missed the start of this thread, so if this question

One way of determining relative delays between two signals would be
to track the zero-crossings of both and compare them. If they're
complex waveforms (e.g.  not simple sines), in theory you could
match them by shape as well; that could mean a lot of computation,
depending on the waveform complexity, but do-able. That would give
you something like (using ^ and + for the zero-crossings):

S1:  ...xxxx^xxxxxxxxxx^xxxxxxxxxx^xxxxxxxxxx^xxxxxxxxxx^xxx...
S2:  ...xxxx+xxxxxxxxx+xxxxxxxxx+xxxxxxxxx+xxxxxxxxx+xxx...

Assuming you know the sampling frequency, and can detect the
zero-crossings, you can determine the frequencies of S1 and S2
as well as their "relative time of arrival" in some sense.

Since you've probably already considered this and rejected it, what
exactly beyond this information is it that you are seeking? Or, to
put it another way, why is this approach inappropriate for what
you're attempting to achieve?

Frank McKenney
--
Recessions are the market's way of teaching Americans economics.
--
Frank McKenney, McKenney Associates
Richmond, Virginia / (804) 320-4887
Munged E-mail: frank uscore mckenney ayut mined spring dawt cahm (y'all)
```
```Ron N. wrote:
> On Nov 6, 10:11 am, "Mason" <plsnos...@plsnospam.net> wrote:
>> Understood.  My goal is to measure relative circuit time delay.  I can
>> compare the input and output phases to/from the two circuits.  This
>> information is available at the measurement location via independent
paths.
>> But both relative phase measurements have to be done at the same time
>> because the frequencies are different.  Making simultaneous measurements
is
>> hard.  To reduce the dependency on time of measurement I am proposing to
>> shift the signals to exactly the same frequency, and my question is will
>> doing this destroy their relative phase relationship that I am trying to
>> measure in order to determine relative circuit delay time?
>
> You realize that changing the frequency will change the phase at
> every point except one, thus distorting any relative phase comparison
> except at that one reference point.  Why not make the one point
> where the phase doesn't change to be your measurement location?
> Because then you will already know the result of your measurement
> and don't need to change the rest of the waveform to match that
> same value.

If the path delay is unknown, then even that approach fails. If the path
delay is known, then no measurements are needed.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```