简体   繁体   中英

What's the octave equivalent of eig(X, 'nobalance')

I'm trying to find the equilibrium distribution of a markov chain, which means finding the eigenvalues of the transition matrix representing it, however, the eig function automatically normalises the eigenvectors it returns, in MatLab there is a flag you can pass to the function to stop this behaviour

eig(X, 'nobalance')

Where X is a matrix. See http://www.mathworks.com/help/techdoc/ref/eig.html . However, when I try this in octave I just get an error:

error: eig: wrong type argument `sq_string'

Is there some other function I should be calling?

Cheers

If your goal is to compute the equilibrium distribution of a Markov chain, take a look at the mcStatDist function implementation from the PMTK3 toolbox . It shows four different ways to compute the result. Example:

TR = rand(3,3);                          %# random transition matrix
TR = bsxfun(@rdivide, TR, sum(TR,2));    %# normalize so that rows sum to one

[V,D] = eig(TR');                        %'# eigen-decomposition
EQ = V(:,1) ./ sum(V(:,1));              %# state equilibrium distribution

As noted in the comments of the linked code, this method can be numerically unstable for some cases, so you might want to consider one of the other options...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM