Inverting large matrices

Hi All - any hints on inverting large I'll conditioned matrices? Doing an LM test and it goes crazy every now and then because of his...

1 Answer


You could try using olsqr or the slash operator '/', with an identity matrix as the response variable. The LU and QR algorithms are more numerically stable and may work.

inverse = olsqr(eye(rows(A)), A);
inverse = eye(rows(A))/A;

If that does not work, you could add a small coefficient to the diagonal of the matrix and try the inversion. The definition of small, of course, will depend on the scale of your matrix. Ideally, you want to add the smallest constant such that the inversion appears sane.

lambda = 1e-7 .* eye(rows(A));
inverse = invpd(A + lambda);

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy