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 Pyt开发者_StackOverflowhon, or how could I replace it?
The spectrum
package has such a function.
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.
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
精彩评论