Dual wielding laptops

My poor netbook (Samsung NF210, which you might remember from my issue with the Grub 2 menu) has been dying under the weight of Matlab, LabView, and all the other normal programs that I run on a constant basis such as Acrobat Reader, TeXnicCenter, and Chrome.

I have had to pull my old laptop (Acer Aspire 5670) out of retirement. After a couple hours of setup, I had two laptops set up on my desk. This is when I found out that I am not an embarrassingly parallel procedure. By effectively doubling the number of processors that I was running on, my productivity went up about 50%.

The key to all of this has actually turned out to be a piece of software that I admit I turned my nose up to a bit when I first saw it...

Dropbox

I installed Dropbox on both laptops and told them to sync my folder full of work files. A couple minutes later everything was mirrored on both computers as well as on the online system.

Since I have wireless Internet on both laptops, they can both connect instantaneously the the online Dropbox repository and sync files with one another. The total lag time from when I save a file on one to when it shows up on the other is on the order of mere seconds.

This allows me to work on highly technical material on one computer, and be completely confident that all of my progress is saved elsewhere. Additionally, it gives me great mobility and freedom of mind.

I admit, I should probably be a poster child for Dropbox at this point.

Care about your files? Not too worried about putting them in the cloud? Try Dropbox. It impressed me.

Matlab Fast-Fourier Transform (FFT)

I have spent a lot of time in the last couple weeks fighting to discern some meaning from the results of some Fourier transforms I was doing. During this time I ran across some very helpful resources.

First and foremost among them is this excellent FFT tutorial for Matlab over at blinkdagger. I found this code and explanation to be very useful.

I still had a lot of learning to do however, especially about the correct frequency axis for my data. The simplest way to understand it (as far as I know) is this:

If you run an FFT on 9000 real-valued data points, then it will return an array of 9000 complex values. If you plot the complex modulus (absolute value, or abs(data) function in Matlab), then you will see that the magnitude of the data is symmetric. That is, the first 4500 points are the same as the last 4500 points. In fact there is an interchange of complex and real parts of the symmetric data, but we won't get into that here.

The important part for me was to realize that if I look at only the first 4500 points, then point number 1 represents the lowest frequency component in the signal that can be detected. The 4500th point is the highest-frequency point that can be detected. What frequency is this point?

It is the Nyquist frequency, equal to half of the sampling rate. The maximum frequency that we can extract from the data is half the sampling frequency. Therefore if your data was taken at a rate of six per second (6 Hertz, or one every 0.166667 seconds), then the Nyquist frequency would be 3 Hertz.

This allows you to create a meaningful frequency axis for your Fourier-transformed data. The highest point is the Nyquist frequency, and the lowest point would be equal to the Nyquist frequency divided by the number of data points. In my above example, that would be 3 Hertz / 4500 data points = 0.00066666 Hertz.

As simple as this sounds, it did take me a little while to figure out.

Secondly, in case anyone is taking the FFT of real-world data, it is very likely that you will have to view it on a log-log axis in order to get anything meaningful out of looking at it. Much of the useful information to humans is often clustered around the low-frequency end. Viewing the data in log-log is very helpful for this. Also, this view can help you identify intensity dropoffs with increasing frequency. Some common ones are 1/f and 1/f^2.

To view in log-log, the matlab command is:

loglog(xAxisData,yAxisData);

If there are no other figures created, this will create a figure with your plot in it.