Showing posts with label numpy. Show all posts
Showing posts with label numpy. Show all posts

Sunday, February 13, 2011

Instantaneous Amplitude, Phase and Frequency

Here is a link to a good discussion on this with MATLAB code.

Here is another place with a good discussion on doing a phase shift.
The Hilbert transform is fft ---> phase shift ---> ifft.
Doing fft and ifft are easy in numpy, and a phase shift is just multiplying each term in the signal by exp(j*p), where j is the imaginary unit, and p is the desired phase shift.

Thursday, October 7, 2010

Variance

Different programs implement variance in different ways. This can lead to confusing results when you move from one set of functions to another.

scipy.stats.cov() normalizes by (N-1), by default, bias=False. By setting bias=True, you will normalize by N.

However, scipy.var() normalizes by N.

In Octave, var( x, 0 ) biases by N-1, and var( x, 1 ) biases by N.

Matlab and R, I think, do things slightly differently.

Friday, October 1, 2010

NumPy and Input/Output

Super dooper resource for NUmPy I/O can be found here. Includes information on how to interpret binary data, and use the NumPy alias of the the MATLAB fread() function.

Tuesday, August 24, 2010

Scipy and NumPy Documentation

Python has modules several modules, Scipy and NumPy, that offer very similar functionality to the functions offered by Matlab. (This is not a conclusive list of math/science related Python modules, but this is a good place to start.)

N.B. I found that to use scipy.linalg.eig(A), I needed to say: import scipy; from scipy import linalg. That did the old tricking.

The Tentative NumPy Tutorial may be found here.

NumPy for Matlab users may be found here.