Professor Sampler’s Notes: Sampling Analog Signals

Topics Covered:

  • What is sampling
  • What is Calculus
  • How to deal with complex wave functions
  • The beauty of a Fourier transformed signal

Give me a lever long enough and a fulcrum on which to place it, and I shall move the world – Archimedes

The only way to reproduce an analog signal perfectly is to continuously sample it. If you take your eyes away for even one instant, that part’s gone forever. But digital systems by definition have to take their eyes off many times. When they are looking, they are said to be sampling. Sampling can be done once – like when you sample a taste of one flavor of ice cream, or more – like when you finish the entire family pack.
Ice Cream
The ice cream example is a tricky one. If I sample the entire ice cream pack, then haven’t I sampled an analog system perfectly? Whoa! This is where you have to remember that as far as sampling signals is concerned, we are not talking semantics, but science. Our common sense tells us that we can sample a pack of ice cream perfectly, but thinking of it a bit differently gives us the real picture:

What if, instead of ice cream, I have Humpty Dumpty in a container – can I ever put him back together again?

It’s important to understand how we use language. It has its limits, and one of the worst things one can do is to use a very specific scientific or engineering term out of its context. You see examples of this everyday all around you – sometimes the blunders come from engineers themselves. The best thing you can do in this scenario is to follow Socrates’ advice:

If you would like to speak to me, define your terms – Socrates

Sampling might seem like a very intuitive idea, but applying it according to rigorous standards is anything but. It’s not fair to be too hard on yourself (or anyone else for that matter). Ice cream and Humpty Dumpty don’t look very different at the atomic level. But don’t let that fool you! You know from our earlier notes that the atomic world is way weirder than our macro world.

It only gets worse. Here’s a potential deal breaker:

A sampling system must unfortunately know what it is sampling in order to figure out how to sample it.

Oops. No one size fits all solution here. Since semiconductors can’t think for themselves, we humans have to tell them how to interpret each signal, and that means a sampling system is sampling subjectively! The challenge for engineers is to find a way to reduce this subjectivity to a minimum. It’s funny when you come to think of it, really. The whole history of digital signal processing is a struggle to find ways to eliminate subjectivity within a digital system, so that an artist can ‘objectively’ use that equipment in the pursuit of artistic subjectivity! Humans, I tell you.

So let’s cut our helpless engineers some slack. One wouldn’t have given them good odds, but surprisingly, they have made excellent progress. Let’s lay some groundwork to better appreciate the scale of their achievements. Let’s talk math.

We can’t use simple arithmetic or geometry to define continuous complex signals. That’s why they leave most of the scary stuff for after high school. The branch of mathematics that deals with the dirty work is called Calculus. To get a handle on continuous signals, mathematicians decided to look at things as the sum of near-zero theoretical parts called infinitesimals (for lack of a better word).

Basically, what calculus does is cut things up into infinitesimal parts, shuffles them around to pass the time, and then puts them together again if it can. I just showed earlier how this is impossible, yet mathematics has found a way to approximate the impossible within the bounds of acceptability. Damn.

Next time you see a mathematician staring at a blackboard puzzling over symbols as strange as our caveman’s, you know she (or he, if he doesn’t know any better) is trying to put Humpty Dumpty back together again. It’s not an enviable job. In fact, I would put the emotional quotient of this job on par with cleaning toilets at busy stations (a losing battle, ask any janitor), with job satisfaction only on public holidays, or that over-hyped eureka (yeah right) moment. Our mathematician consoles himself with the following thought:

The journey is its own reward – Homer

Remember I mentioned earlier that the idea behind all science is not only to know nature, but also to predict its behavior? We do this with the help of equations and functions.

Let’s buy a pet:
T-Rex

The idea of differential calculus is to find a T-Rex for a pet, convert it into its mathematical brother (the function), and then curse your luck (because its moods are more unpredictable than you thought), cut it up into an infinite number of infinitesimal bits and then force your ideas on each bit. The result? A baby veggie-saur that mathematicians call the derivative of that function (T-Rex). They hope this baby function (Veggie-saur) is more manageable as a pet. Just like one’s hope that sausages are easier to eat and digest than raw meat (where do these ideas come from?).

If our baby veggie-saur isn’t perfect, we can do the same to him, and we might get a potato-saur. Our potato-saur is also called a second order differential equation, because the veggie-saur was the first. Guess what, some people aren’t happy with the potato-saur either. But there’s danger lurking here. The problem is, the more one differentiates the tougher it gets to retrace your steps.

So we differentiate within limits, and then find other ways to handle our equations. One way to do this is to use Transformations. It’s sort of like dressing up our potato-saur to look more presentable, maybe with a bit of makeup.

One of the most famous transformation methods known to man is the Fourier transform. A Fourier transform converts a differential equation into a sum of simpler trigonometric functions, and we all know that is high school math territory. And there is a spectacular side effect to this transform.

In my explanation of waves I’d said that waves usually have a frequency. The traditional method of dealing with waves and frequency happens to be with trigonometric functions, most famously the Sine function.

Voila! That means if we have a differential equation that is supposed to represent our efforts at understanding a wave, then its Fourier transform will give us an equation (or bunch of simpler equations) that not only contain the original ‘stuff’, but also help us deal directly with the frequencies in the original wave. Our veggie-saur can be dressed up like a potato-saur with some simple plastic surgery and it also speaks our language! And it gets better. The Fourier transform can be used not only for continuous signals, but also for discrete functions! Somebody give the man a pat on the back, or better yet, the Nobel Prize. Did they? I’ll let you figure that one out.

The Fourier transform drives almost every single device today: music players, DVDs, cameras, compression, audio, mobile phones, computers, you name it. Just get with the program.

For those of you who are missing our beloved T-rex please take heart. He’s hanging on in there somewhere. We’ll try our best to get him back soon.

What we have learnt is that the mathematical groundwork is ready to deal with the process of converting complex analog signals into discrete functions that can be dealt with as required. Now for the dirty work.

Takeaways:

  • The process of converting a continuous analog signal into discrete bits is called sampling
  • An analog or digital signal is complex, and that is reflected in its wave function
  • A Fourier transform allows an engineer to break down a complex wave function into functions that directly relate to its frequency spectrum.
  • A sampling algorithm, process or system cannot sample a signal unless it knows its limits. There is always an element of subjectivity involved.

Links for further study:

Next: Professor Sampler’s Notes: The Shannon-Nyquist Sampling Theorem Part I
Previous: Professor Sampler’s Notes: Disadvantages of Digital Systems