# Question on AM demodulation...

Started by June 13, 2014
```Hi all,

I am a bit stuck in a demodulation thing.

Lets say I have a system that generates an AM signal and
wants to detect distorsions of the LF signal after feeding
the AM modulated signal through a potentially nonlinear system.

This means I have phase locked TX and RX.

Lets say I modulate a signal at f0 with sine at f1
with 100% modulation:

signal = sin(w0*t) * (0.5 + 0.5 * sin(w1*t))

I then receive this signal and downmix it by multiplying
with sin and cos of the carrier frequency, in complex
writing:

I have then a complex baseband signal, in which I expect
sidebands at +- f1.

Lets say I am after the overtones of that f1 in the complex
baseband signal. For example, I want to detect components
at +-f2 with f2 = 2*f1.

Can I not just multiply the complex baseband signal with
e^(i*w2*t) to get the (compelex)component at f2?
Like:

what_i_look_for = baseband * e^(i*w2*t)

Or do I miss some conjugate etc?

As said above, everything is phase locked, so I do not need to recover
any phase.

best regards,

Andre

```
```On 6/13/14 9:26 AM, Andre wrote:
> Hi all,
>
> I am a bit stuck in a demodulation thing.
>
> Lets say I have a system that generates an AM signal and
> wants to detect distorsions of the LF signal after feeding
> the AM modulated signal through a potentially nonlinear system.
>
> This means I have phase locked TX and RX.

well, we normally get phase locking between TX and RX because the
carrier is not suppressed.  commercial AM that is not over-modulated is
not quite the same thing as DSB-SC.  it is because of this that one can
use a simple rectifier (like the 1N34 i used in a crystal radio 5
decades ago - sheeesh i'm getting old!) to demodulate the AM.

>
> Lets say I modulate a signal at f0 with sine at f1
> with 100% modulation:
>
> signal = sin(w0*t) * (0.5 + 0.5 * sin(w1*t))

so now, the right-hand factor is fully non-negative, right?

>
> I then receive this signal and downmix it by multiplying
> with sin and cos of the carrier frequency,

dunno why you would use cos(w0*t) since the carrier is sin().

> in complex
> writing:
>
> baseband = received_signal * e^(i*w0*t)
>
> I have then a complex baseband signal, in which I expect
> sidebands at +- f1.
>
> Lets say I am after the overtones of that f1 in the complex
> baseband signal. For example, I want to detect components
> at +-f2 with f2 = 2*f1.

if the nonlinearity is applied to "signal", you're gonna get components
at more than that.  to analyze this, you need to express "signal" as a
sum of the the individual frequency components.  i think you'll get
f0-f1, f0, and f0+f1 (and all of the negatives of those 3).  *then* run
that through the nonlinearity and see what frequency combinations come out.

>
> Can I not just multiply the complex baseband signal with
> e^(i*w2*t) to get the (compelex)component at f2?
> Like:
>
> what_i_look_for = baseband * e^(i*w2*t)
>
> Or do I miss some conjugate etc?
>
> As said above, everything is phase locked, so I do not need to recover
> any phase.

of course you don't.  it's AM with unsupressed carrier.

--

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."

```
```On Fri, 13 Jun 2014 15:26:22 +0200, Andre <lodwig@pathme.de> wrote:

>Hi all,

Hello Andre,

>I am a bit stuck in a demodulation thing.
>
>Lets say I have a system that generates an AM signal and
>wants to detect distorsions of the LF signal after feeding
>the AM modulated signal through a potentially nonlinear system.

Humm, it's hard for me to imagine what you mean
by a "potentially nonlinear system."

>This means I have phase locked TX and RX.
>
>Lets say I modulate a signal at f0 with sine at f1
>with 100% modulation:
>
>signal = sin(w0*t) * (0.5 + 0.5 * sin(w1*t))
>
>I then receive this signal and downmix it by multiplying
>with sin and cos of the carrier frequency, in complex
>writing:
>

If by the strange word "downmix" you mean
"complex down-conversion", then there should
be a minus sign before the 'i' in the above
exponent.

>I have then a complex baseband signal, in which I expect
>sidebands at +- f1.

Sounds correct so far.
(After down-conversion it's typical to pass the
down-converted signal through a lowpass filter
so that only energy in the neighborhood of
zero Hz remains. This, of course, requires two
real-valued filtering operations.)

>Lets say I am after the overtones of that f1 in the complex
>baseband signal. For example, I want to detect components
>at +-f2 with f2 = 2*f1.

Ah, now I think I understand what you mean in

It appears you want detect the power of unwanted
spectral components in your complex baseband signal
that were caused by the original real-valued AM signal
passing through some sort of nonlinear process.

>Can I not just multiply the complex baseband signal with
>e^(i*w2*t) to get the (compelex)component at f2?
>Like:
>
>what_i_look_for = baseband * e^(i*w2*t)

Multiplying your complex baseband signal by
e^(i*w2*t) does *NOT* "get the component at f2."

Multiplying your complex baseband signal by
e^(i*w2*t) performs frequency translation of
your baseband signal up in frequency by f2 Hz.

>Or do I miss some conjugate etc?

I don't know what "miss some conjugate" means.

OK, let's step back for a moment.  It looks
like you have a real-valued AM signal
whose carrier freq is f0 Hz.  And you want to detect
the average power of the spectral component
whose frequency is f0 + f2, where f2 = 2f1.

It seems to me that you have a few options:

Option #1: Perform an FFT on your AM signal and
monitor the magnitude of the FFT bin whose freq
corresponds to the f0 + 2f1 frequency.
(This ooption may be too computationally intense.)

Option #2: Perform your complex f0 Hz down-conversion,
lowpass the baseband signal, decimate the filtered
baseband signal, and perform an FFT on the decimated
signal. Then monitor the magnitude of the FFT bin
whose freq corresponds to the 2f1 frequency.

Option #3: Perform a complex f0+f2 Hz down-conversion,
lowpass the baseband signal.  Then monitor the magnitude
of the lowpass filter's output.

Option #4: Perform your complex f0 Hz down-conversion,
lowpass the baseband signal and decimate the filtered
baseband signal.  Pass the real-part of the decimated
signal through a Goertzel filter that's tuned to 2f1 Hz.
Then monitor the magnitude of the Goertzel filter output.

Hope that helps.

[-Rick-]
```
```On Fri, 13 Jun 2014 15:26:22 +0200, Andre wrote:

> Hi all,
>
> I am a bit stuck in a demodulation thing.
>
> Lets say I have a system that generates an AM signal and wants to detect
> distorsions of the LF signal after feeding the AM modulated signal
> through a potentially nonlinear system.
>
> This means I have phase locked TX and RX.

How so?  AM has never required phase locking -- the TX can free run, and
the RX can do envelope detection.

> Lets say I modulate a signal at f0 with sine at f1 with 100% modulation:
>
> signal = sin(w0*t) * (0.5 + 0.5 * sin(w1*t))
>
> I then receive this signal and downmix it by multiplying with sin and
> cos of the carrier frequency, in complex writing:
>
> baseband = received_signal * e^(i*w0*t)

As mentioned, it's e^(-i*w0*t), but that's a nit -- particularly because
the operation will still work (why is left as an exercise to the reader).

For that matter, if the receiver really is phase locked, then you only
need to down-convert with sin(w0*t).

> I have then a complex baseband signal, in which I expect sidebands at +-
> f1.

Again, as mentioned, you're neglecting the signal at 2*f0 here, which one
would usually filter out.

> Lets say I am after the overtones of that f1 in the complex baseband
> signal. For example, I want to detect components at +-f2 with f2 = 2*f1.
>
> Can I not just multiply the complex baseband signal with e^(i*w2*t) to
> get the (compelex)component at f2?
> Like:
>
> what_i_look_for = baseband * e^(i*w2*t)

You could, yes.  That'll only yet you the second harmonic of the
fundamental, though -- it'll miss the third, fourth, etc.

> Or do I miss some conjugate etc?
>
> As said above, everything is phase locked, so I do not need to recover
> any phase.

I don't know if your "everything is phase locked" statement comes from
naivet&eacute; or from some system feature you're not sharing with us, but in
conventional AM reception you _do_ need to recover phase, usually via a
PLL, or you do envelope detection and stay blithely unaware of phase.

--

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

```
```robert bristow-johnson wrote:
> On 6/13/14 9:26 AM, Andre wrote:
>> Hi all,
>>
>> I am a bit stuck in a demodulation thing.
>>
>> Lets say I have a system that generates an AM signal and
>> wants to detect distorsions of the LF signal after feeding
>> the AM modulated signal through a potentially nonlinear system.
>>
>> This means I have phase locked TX and RX.
>
> well, we normally get phase locking between TX and RX because the
> carrier is not suppressed.  commercial AM that is not
> over-modulated is not quite the same thing as DSB-SC.  it is
> because of this that one can use a simple rectifier (like the
> 1N34 i used in a crystal radio 5 decades ago - sheeesh i'm
> getting old!) [SNIP]

You youngster. Believe I have you beat by almost a decade ;/
P.S. y father told stories of operating a legal _land based_
spark gap transmitter.
PPS Have seen a spark gap transmitter in operation - OK already,
its operating permit specified that it have no antenna, and IIRCC
it could operate for no more than 10 minutes per week.(mid late
50's).
```
```On 6/13/14 10:32 PM, Richard Owlett wrote:
> robert bristow-johnson wrote:
>> On 6/13/14 9:26 AM, Andre wrote:
>>> Hi all,
>>>
>>> I am a bit stuck in a demodulation thing.
>>>
>>> Lets say I have a system that generates an AM signal and
>>> wants to detect distorsions of the LF signal after feeding
>>> the AM modulated signal through a potentially nonlinear system.
>>>
>>> This means I have phase locked TX and RX.
>>
>> well, we normally get phase locking between TX and RX because the
>> carrier is not suppressed. commercial AM that is not
>> over-modulated is not quite the same thing as DSB-SC. it is
>> because of this that one can use a simple rectifier (like the
>> 1N34 i used in a crystal radio 5 decades ago - sheeesh i'm
>> getting old!) [SNIP]
>
> You youngster. Believe I have you beat by almost a decade ;/
> P.S. y father told stories of operating a legal _land based_ spark gap
> transmitter.
> PPS Have seen a spark gap transmitter in operation - OK already, its
> operating permit specified that it have no antenna, and IIRCC it could
> operate for no more than 10 minutes per week.(mid late 50's).

like 1956?  (my birth year)

i remember seeing a Titanic movie (not the one with Leonardo Dicaprio)
where they were sending SOS out on a spark-gap transmitter.  never seen
one in real life.  but i seen a lotta TVs with tubes in them.  hell,
even my ham radio (the Heathkit HW-100) was tube (except for a couple of
transistors in the VFO).

we're gonna have to get together and commisuerate about them olden daze
someday.

L8r,

--

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."

```
```Hi,

multiply with
exp(i 2 pi f t) => upconversion by f
exp(-i 2 pi f t) => downconversion by f
Note the minus sign, for downconversion, which could be rewritten as
conj(exp(i 2 pi f t). So here's the conjugate.

So if you want to move f2 to 0 Hz, multiply with exp(-i 2 pi f2 t) and
lowpass filter.

Note that distortion at RF and baseband are related, but not the same. I
http://www.dsprelated.com/showarticle/108.php

There is also a Matlab script in the second half for OFDM-ish signals that
could be trivially modified for sine waves. It shows positive and negative
frequencies, for example.

_____________________________
Posted through www.DSPRelated.com
```
```On Fri, 13 Jun 2014 15:26:22 +0200, Andre <lodwig@pathme.de> wrote:

>Hi all,
>
>I am a bit stuck in a demodulation thing.
>
>Lets say I have a system that generates an AM signal and
>wants to detect distorsions of the LF signal after feeding
>the AM modulated signal through a potentially nonlinear system.
>
>This means I have phase locked TX and RX.
>
>Lets say I modulate a signal at f0 with sine at f1
>with 100% modulation:
>
>signal = sin(w0*t) * (0.5 + 0.5 * sin(w1*t))
>
>I then receive this signal and downmix it by multiplying
>with sin and cos of the carrier frequency, in complex
>writing:
>
>
>I have then a complex baseband signal, in which I expect
>sidebands at +- f1.
>
>Lets say I am after the overtones of that f1 in the complex
>baseband signal. For example, I want to detect components
>at +-f2 with f2 = 2*f1.
>
>Can I not just multiply the complex baseband signal with
>e^(i*w2*t) to get the (compelex)component at f2?
>Like:
>
>what_i_look_for = baseband * e^(i*w2*t)
>
>Or do I miss some conjugate etc?
>
>As said above, everything is phase locked, so I do not need to recover
>any phase.
>
>best regards,
>
>Andre

Hi Andre,
My my.  How strange is life.

I was searching around the web today an ran across
a web page that could be helpful to you.  (It
discusses complex down-conversion).  If you're
interested, start reading the Section "Sampling
Theorem Misconception" on page 36 of the paper at:

http://www.engr.sjsu.edu/rmorelos/ee160f10/Nyquist_Barrier_Misconception.pdf

See Ya',
[-Rick-]

```
```On Fri, 13 Jun 2014 17:39:41 -0500, Tim Wescott
<tim@seemywebsite.really> wrote:

>On Fri, 13 Jun 2014 15:26:22 +0200, Andre wrote:
>
>> Hi all,
>>
>> I am a bit stuck in a demodulation thing.
>>
>> Lets say I have a system that generates an AM signal and wants to detect
>> distorsions of the LF signal after feeding the AM modulated signal
>> through a potentially nonlinear system.
>>
>> This means I have phase locked TX and RX.
>
>How so?  AM has never required phase locking -- the TX can free run, and
>the RX can do envelope detection.
>
>> Lets say I modulate a signal at f0 with sine at f1 with 100% modulation:
>>
>> signal = sin(w0*t) * (0.5 + 0.5 * sin(w1*t))
>>
>> I then receive this signal and downmix it by multiplying with sin and
>> cos of the carrier frequency, in complex writing:
>>
>> baseband = received_signal * e^(i*w0*t)
>
>As mentioned, it's e^(-i*w0*t), but that's a nit -- particularly because
>the operation will still work (why is left as an exercise to the reader).

Hi Tim,
For normal symmetrial bandpass (commercial) AM,
yes the e^(-i*w0*t) is a "nit".  But for
single-sideband AM, the e^(-i*w0*t) is not a "nit."
(I'm bein' nit-picky pain in the neck here.)

See Ya',
[-Rick-]
```
```On Sat, 14 Jun 2014 20:13:56 -0700, Rick Lyons wrote:

> On Fri, 13 Jun 2014 17:39:41 -0500, Tim Wescott
> <tim@seemywebsite.really> wrote:
>
>>On Fri, 13 Jun 2014 15:26:22 +0200, Andre wrote:
>>
>>> Hi all,
>>>
>>> I am a bit stuck in a demodulation thing.
>>>
>>> Lets say I have a system that generates an AM signal and wants to
>>> detect distorsions of the LF signal after feeding the AM modulated
>>> signal through a potentially nonlinear system.
>>>
>>> This means I have phase locked TX and RX.
>>
>>How so?  AM has never required phase locking -- the TX can free run, and
>>the RX can do envelope detection.
>>
>>> Lets say I modulate a signal at f0 with sine at f1 with 100%
>>> modulation:
>>>
>>> signal = sin(w0*t) * (0.5 + 0.5 * sin(w1*t))
>>>
>>> I then receive this signal and downmix it by multiplying with sin and
>>> cos of the carrier frequency, in complex writing:
>>>
>>> baseband = received_signal * e^(i*w0*t)
>>
>>As mentioned, it's e^(-i*w0*t), but that's a nit -- particularly because
>>the operation will still work (why is left as an exercise to the
>
> Hi Tim,
>   For normal symmetrial bandpass (commercial) AM,
> yes the e^(-i*w0*t) is a "nit".  But for single-sideband AM, the
> e^(-i*w0*t) is not a "nit."
> (I'm bein' nit-picky pain in the neck here.)

True.  I just think of SSB as SSB, though.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
```