Thursday, May 2, 2013

Up, Down, Up, Down...

This is

y=sin(x), courtesy of Google.com. This is actually one of Google's cooler features, the ability to do simple plots from the search box. I highly recommend trying it out! 

No worries, touting the much awesomeness of Google is not why I'm here tonight.

The title describes it pretty well I think. There are many things that go up and down in our world: the light switch in your office, the bumps on the road, the hands on the clock (well if you just look at the motion of the tip of the hand, there's up/down there), and the function shown above. You don't just have to limit it to up/down, you can also say forward/back (like a playground swing), or left/right (like a pendulum and the tips of the hands of the clock, again).

If you think about sound, and one of the fundamental sources of sound, a speaker, you come to realize that the motion of the speaker is forward/back (depending on how you view it). The diaphragm of the speaker moves back and forth depending on the signal coming to it from the amplifier (Electrodynamics of a voice coil is another blog post...way down the road), and this in turn pushes the air molecules back and forth, creating a sound wave that propagates. This sound wave can reach someone's ear, where it can be heard (Might get to hearing at some point in the future, it's a bit of an interest to me).

So now we know what the motion looks like, how do we write that down? Typically words are great at describing fixed or static things, but nobody wants to type the position of a speaker diaphragm as it is moving. First, you would be writing until the object stopped moving. Second, no one can type fast enough while measuring the speaker diaphragm position in order to do it accurately. Third, even if you get the position correct, when was it correct? 

Luckily, us folks with a math background have functions! We can describe a wide variety of shapes, complex geometries, solids, curves, and surfaces using mathematical functions. The cool part, and the part I want to talk about on here a lot, is how to describe motion. This is, after all, the most fun with a piece of chalk! (If you know what that means, please feel free to comment! Guesses are welcome too!) (Nick M, you're not allowed to guess, neither are you Peter R, if you read this.)

I plotted sin(x), which is the vertical position of y, when y is the sin(x). This makes it valid for any two dimensional set of labeled axes. (Note I said labeled, this is a pet peeve of mine...) However this can be made just as valid for y=sin(.08*pi*t), where t is time, let's assume in seconds. (Yes, I know I added a parameter, I'll get there soon!) Let's also assume that y is something we can measure, like the position of the speaker diaphragm, in inches. This position can be measured with sometime like a laser used by a contractor to measure the rooms in a house, except really accurate, and it can measure it over a constantly repeated time span (Once per second... Ugh, Sampling, the topics keep piling up) This would look a little like this:



Here's the nifty part, we can use that measured function to replicate it, and in turn get an image of the original y=sin(.08*pi*t). In fact, we do it all the time! We measure tons and tons of complex things, record them, store them, transmit them, reconstitute them, and play them back (probably though a speaker). However in order understand the content of the things we measure, we have to compare them to some reference. Because the general motion of a lot of stuff is back/forth, left/right, up/down, a sinusoid is a great way to do this.

So what was with that extra bit I put into the sin() function above? I'll save that for next time...

In case you guys haven't noticed, I'm trying to do this Tuesdays and Thursdays, and I might sneak in a Sunday here or there, depending on if I'm home and how much other crap I have to do. I see people taking a peek, but still no comments (but a couple +1's on Google+). I know I'm pretty light on these topics (for some people...). If something gets too complex too quick, drop me a message on here and I can try to explain things better.

-CMW