Showing posts with label Matlab. Show all posts
Showing posts with label Matlab. Show all posts

Friday, June 5, 2009

Fast Correlation

I've uploaded a small package to the Matlab File Exchange to improve the speed of your cross correlations. This package uses the FFT to calculate the circular cross correlation of two periodic signals. Since the FFT calculates the DFT of a N-point signal in O(N log N) calculations (rather than O(N2)) it is much faster than the naïve method, especially for long signals. In Matlab, the fft method is faster than the multiplication method in all but the most trivial cases, as shown in the image, plotting the ratio of the speed of the fast method to that of the naïve method from the definition. The figure also shows that the fft algorithm is typically fastest when N is a power of 2, and slowest when N is prime.

Thursday, February 19, 2009

Driving Times in NZ


After our trip around the South Island, I got to thinking about how long it takes to get everywhere in this small country. So I made this map of the driving time from our house in Auckland to everywhere in the country. The driving times come from a Matlab script I wrote that queries Google maps, and the mapping functions are from M_Map for Matlab, using shoreline data from GSHHS. Click it for higher resolution.