# AM demodulation

Started by October 7, 2003
```Having looked through countless websites and books, I've learnt loads,
but not what i'm looking for: An algorithm for AM demodulation...  Can
anyone help?
```
```Steve wrote:
> Having looked through countless websites and books, I've learnt loads,
> but not what i'm looking for: An algorithm for AM demodulation...  Can
> anyone help?

demodulation

output =3D lowpass filter ( abs (input) )

Ren=E9

```
```Or

output = sqrt(input^2+HilbertTransform^2(input))

or same as above but with some aproximation of the sqrt(a^2+b^2)

Michal
"Ren&#2013265929;" <username@fel.nl> p&#2013265933;se v diskusn&#2013265933;m pr&#2013265933;spevku news:3f82961f\$1@cs1...
Steve wrote:
> Having looked through countless websites and books, I've learnt loads,
> but not what i'm looking for: An algorithm for AM demodulation...  Can
> anyone help?

demodulation

output = lowpass filter ( abs (input) )

Ren&#2013265929;

```
```Ren&#2013265929; <username@fel.nl> wrote in message news:<3f82961f\$1@cs1>...
> Steve wrote:
> > Having looked through countless websites and books, I've learnt loads,
> > but not what i'm looking for: An algorithm for AM demodulation...  Can
> > anyone help?
>
> demodulation
>
>
> output = lowpass filter ( abs (input) )
>
>

This stuff doesn't exactly come naturally to me...
All i have at the mo is a list of numbers, a sampled signal... how do
i get the above to work on a list of numbers? Can anyone point me in
the direction of a C implementation of the above or any other type of
AM demodulation??

p.s. i think in C not maths!! i study for uni maths exams by
converting it all to C and running the program....so if you need to
mention a hilbert trasform can ya give it in C !!!
```
```Hi Steve : when you say sampled , how was it sampled? Is this list a set of
complex numbers or real numbers and what's the spacing between the samples?
Best of Luck - Mike

"Steve" <steven.fox@nuigalway.ie> wrote in message
> Ren&#2013265929; <username@fel.nl> wrote in message news:<3f82961f\$1@cs1>...
> > Steve wrote:
> > > Having looked through countless websites and books, I've learnt loads,
> > > but not what i'm looking for: An algorithm for AM demodulation...  Can
> > > anyone help?
> >
> > demodulation
> >
> >
> > output = lowpass filter ( abs (input) )
> >
> >
>
> This stuff doesn't exactly come naturally to me...
> All i have at the mo is a list of numbers, a sampled signal... how do
> i get the above to work on a list of numbers? Can anyone point me in
> the direction of a C implementation of the above or any other type of
> AM demodulation??
>
> p.s. i think in C not maths!! i study for uni maths exams by
> converting it all to C and running the program....so if you need to
> mention a hilbert trasform can ya give it in C !!!

```
```steven.fox@nuigalway.ie (Steve) wrote in message news:<28ce72ef.0310080335.389fd21e@posting.google.com>...

> p.s. i think in C not maths!! i study for uni maths exams by
> converting it all to C and running the program....so if you need to
> mention a hilbert trasform can ya give it in C !!!

Hmmm... I have two objections 'bout that: First, you rely *way* too much on
other people's goodwill. Asking for help with your own code is one thing,
asking someone else to code your stuff up for you is quite another. What
if I or someone else gave you a code littered with bugs? If you don't know
why and how the code is supposed to work, you're lost.

Second, DSP relies on maths. If you have problems with the maths, people
around here are willing to help. Now, I prefer that people at least make
an effort on their own part. The maths can be tricky at times, but that's
a part of DSP. For better or for worse.

Rune
```
```Rune,

I second your whole e-mail. It seems that people who can spell DSP think
they can do it. What you end up with is code that never worked right in the
first place, and no one knows to fix it.

I worked for a while at a major defense contractor that was working with 10
year old DSP code. No one left understood the DSP code, they just got
follow-on contracts to make more copies run and to improve the GUI.  They
should have made the DSP code work right. Amazingly, since the customer was
dumb and happy, the contractor was not real interested in fixing the code to
improve performance or even in bringing it to the customer's attention.
What a shame.

Steve, if you don't do math, you sure as hell don't do DSP.

Dirk

Dirk A. Bell
DSP Consultant

"Rune Allnor" <allnor@tele.ntnu.no> wrote in message
> steven.fox@nuigalway.ie (Steve) wrote in message
>
> > p.s. i think in C not maths!! i study for uni maths exams by
> > converting it all to C and running the program....so if you need to
> > mention a hilbert trasform can ya give it in C !!!
>
> Hmmm... I have two objections 'bout that: First, you rely *way* too much
on
> other people's goodwill. Asking for help with your own code is one thing,
> asking someone else to code your stuff up for you is quite another. What
> if I or someone else gave you a code littered with bugs? If you don't know
> why and how the code is supposed to work, you're lost.
>
> Second, DSP relies on maths. If you have problems with the maths, people
> around here are willing to help. Now, I prefer that people at least make
> an effort on their own part. The maths can be tricky at times, but that's
> a part of DSP. For better or for worse.
>
> Rune

```
```Steve wrote:
> Ren&#2013265929; <username@fel.nl> wrote in message news:<3f82961f\$1@cs1>...
>
>>Steve wrote:
>>
>>>Having looked through countless websites and books, I've learnt loads,
>>>but not what i'm looking for: An algorithm for AM demodulation...  Can
>>>anyone help?
>>
>>demodulation
>>
>>
>>output = lowpass filter ( abs (input) )
>>
>>
>
>
> This stuff doesn't exactly come naturally to me...
> All i have at the mo is a list of numbers, a sampled signal... how do
> i get the above to work on a list of numbers? Can anyone point me in
> the direction of a C implementation of the above or any other type of
> AM demodulation??
>
> p.s. i think in C not maths!! i study for uni maths exams by
> converting it all to C and running the program....so if you need to
> mention a hilbert trasform can ya give it in C !!!

If you know the math well enough to translate it -- correctly -- to C,
you don't need much help with DSP. Just translate the detector equations
to C and voila!

You need the Hilbert transformer only if the carrier isn't sufficiently
oversampled. There are other ways even then. One is to stuff between the
samples with zeros, then filter the result so that it represents no
frequencies that the original sampling frequency won't support. The
result will be suitable for demodulating by Lowpass(average(absval)))
because there are sure to be enough points near the peak of the carrier.

The computation may actually tale a little longer than the Hilbert
method that Kvasnicka described, but the concepts are simpler.

Now get busy translating.

Jerry
--
"I view the progress of science as ... the slow erosion of the
tendency to dichotomize."                    Barbara Smuts, U. Mich.
&#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;

```
```"Dirk Bell" <dirkman@erols.com> wrote in message news:<bm215t\$np\$1@bob.news.rcn.net>...

> I worked for a while at a major defense contractor that was working with 10
> year old DSP code. No one left understood the DSP code, they just got
> follow-on contracts to make more copies run and to improve the GUI.  They
> should have made the DSP code work right. Amazingly, since the customer was
> dumb and happy, the contractor was not real interested in fixing the code to
> improve performance or even in bringing it to the customer's attention.
> What a shame.

<shudder> Those projects are the worst, aren't they... since the project
makes little if any sense in the first place, just about anything goes,
which means that just about anyone can make a "contribution"... not a place
for skilled people to be. The trick is to recognize those things as early
as possible and then get the hell out of there.

As for old code, I am not unfamiliar with code written in relatively
arcane programming languages (Fortran 66), comprising some 100 variable
names like "bca", "ycc", "gwack" and the likes (that version of fortran
had a 6 (8?) character limit on variable names), and where the only
"documentation" of the code was a two-page prosaic text that only vaugely
mentioned the basic concept the code was based on, and then only in the
most general terms.

I think it should be outlawed to express any opinions whatsoever about
computer programming, until one have tried to modify or maintain (or even
compile) that kind of code.

Rune
```
```
Dirk Bell wrote:
>
> I worked for a while at a major defense contractor that was working with 10
> year old DSP code. No one left understood the DSP code, they just got
> follow-on contracts to make more copies run and to improve the GUI.  They
> should have made the DSP code work right. Amazingly, since the customer was
> dumb and happy, the contractor was not real interested in fixing the code to
> improve performance or even in bringing it to the customer's attention.
> What a shame.
>

That is life. Once ago I had the experience similar to yours. I tried to
change the things and I only learned three lessons out of it:

1. Nobody cares what is inside as long as the overall product
performance is satisfactory.
2. If the damn thing works somehow, leave it alone.
3. You are not going to gain much for yourself by trying to improve
somebody's lousy piece of work.

DSP and Mixed Signal Design Consultant

http://www.abvolt.com
```