I've recently been (forced) to learn about PETSC and though I was unhappy at first, its power and functionality has slowly won me over. For those who require parallel computing and speed (stuff our lab does), PETSC gives the functionality to split large jobs (e.g. matrix solves) amongst different processing threads.
Here's a small script I wrote for detecting contractions (beats) in cardiac myocytes. The input is a series of timepoints vs sarcomere lengths. I first used a moving average to smooth the data and took the derivative to look for changes in value i.e. a contraction corresponds to decreasing moving average (detection is threshold based). The slew rate is calculated based off the estimated start/end contraction time points. Finally quality control is implemented using a scatter plot to show where the detected points are.
Despite their seeming similarity, imagesc treats the input matrix as a bitmap grid, while contour treats the input matrix as a matrix. In short, the "y" elements are flipped for a 2D graph depending on which method you use. The fix? flipud(matrix).