Rodrigo Forti
Rodrigo Forti

Reputation: 356

What is the corresponding function for corrmtx (in MATLAB) in Python?

I'm translating some code from MATLAB to Python and I'm stuck with the corrmtx() MATLAB function. Is there any similar function in Python, or how could I replace it?

Upvotes: 1

Views: 1261

Answers (3)

dkroy
dkroy

Reputation: 2020

Here is a list of alternatives that can help you in translating your code, all of which contain that function:
scipy (toeplitz | corrmtx)
spectrum (corrmtx)

The following is a link to another post that tells you how to use numpy for the auto correlation since it seems to be the default funcationality of corrmtx

Additional Information:
Finding the correlation matrix in Python
Unbiased Estimation of Covariance Matrix

Upvotes: 0

JoshAdel
JoshAdel

Reputation: 68702

How about:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.toeplitz.html

The matlab docs for corrmtx state:

X = corrmtx(x,m) returns an (n+m)-by-(m+1) rectangular Toeplitz matrix X, such that X'X is a (biased) estimate of the autocorrelation matrix for the length n data vector x.

The scipy function gives the Toeplitz matrix, although I'm not sure if the implementations are identical.

Upvotes: 1

schlamar
schlamar

Reputation: 9511

The spectrum package has such a function.

Upvotes: 2

Related Questions