Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Some notes about Nyquist's Theorem which I have mentioned in the past.

The result was first suggested by Nyquist, but the first proof was due to Claude Shannon, for which reason you will encounter it with one, the other or both names attached.

It also gives rise to a piece of popular terminology. The width of frequencies you are using determines the rate at which you can send data points, which is how that rate became known as your bandwidth. Technically, though, this is a misnomer because your frequency band limits how fast you can send analog datapoints, not digital ones. But given measurement accuracy, it does put a practical limit on how fast you can send bits.

Now there is an obvious question. Where does the factor of 2 come from?

Well a naive understanding can be gained from saying that you need both sin and cos coefficients.

Someone with more math, comfortable with thinking about complex exponentials (ie exp(i*$x) = cos($x) + i*sin($x)) can remember that if you are going up to frequency f then you are actually dealing with complex exponentials in the range -f to f. So the actual width of the band is twice the frequency range. (Of course out of a positive and a negative exponential term you produce a sin and a cos term, so this is really the same as what we had before.)

Someone with a lot more math can actually produce a very good heuristic as follows. We want to understand the space of L2 functions (L2 means that the square is integrable) which are limited in complex exponentials to the frequency range from $a to $b. Well the first step is to find ourselves a nice orthonormal basis. Well an orthonormal basis is going to remain orthonormal under a Fourier transform, so take the Fourier transform of our functions and in the frequency domain we are talking about L2 functions which are 0 except inside of the interval from $a to $b.

Well L2 functions with support in the range from $a to $b are well understood, and an obvious orthonormal basis is the usual complex exponential basis (which is the usual Fourier series). So apply the inverse Fourier transform to that and (after much calculation) you find that they come back with a basis in terms of functions:

$C*exp(i*($b-$a)/2) * sinc($k + $x*($b-$a))
(I forget the constant $C, and I don't have time to work it out, sorry) where sinc($x) is defined as sin(PI * $x)/(PI * $x). Which very conveniently happens to be 1 at 0, and 0 at every other integer.

So we have our orthonormal basis for this band limited signal, and if we sample at time intervals of 1/($b-$a) we are measuring our basis on the nose. (Because one basis term is 1, and the rest are all 0 there.) How convenient!

Now back to our problem. In the case where we have a maximum frequency f, the range is from -f to f, and voila! The Nyquist rate falls out! (This would likely convince a physicist, but a full formal proof is a lot harder.)

Now if you understood that explanation in full, you have far more math and/or physics than you need. If you kind of got a sense, that is what I was hoping for. If it left you feeling dazed and confused, sorry. This one requires a lot of background that isn't very relevant to Perl, but I find this kind of stuff fun. (And now most of you probably think of me as a sick puppy, but that's OK. I was a math geek long before I ever heard of Perl...)

UPDATE
I miswrote a + as a * in the statement of the basis. My apologies for the typo. I also added a word of clarification about how sinc relates to samples.


In reply to Re (tilly) 1: Nyquist's Theorem in Action with Audio::Wav by tilly
in thread Nyquist's Theorem in Action with Audio::Wav by jeffa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found