Ensure Matrix is Symmetrical

November 30, 2007 · Posted in Matlab 

MatrixMATLAB is a powerful piece of programming language used. However, since it runs on machine, there is always a finite level of precision, no matter how accurate the program is being developed.

For instance, a positive-definite matrix, A, is created with several repmat and permute commands, the symmetry of the entries within the matrix may no longer be exact. This will produce an error indicating that A is not a positive-definite matrix.

One of the way, which is also a very easy method, is to get rid of the slightest discrepancy between the symmetrical entry; for example, A(10,1) should be of the same value as A(1,10). To do so, simply compute the following command after obtaining A.

A = 0.5*(A + AT);

In this way, it ensures that the respective entries in the matrices are exactly symmetrical! A simply tip, but it’s worthwhile using it as a practice.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon


One Response to “Ensure Matrix is Symmetrical”

  1. Gallery of posts up to 12-01-2007 United States WordPress 2.0.11 on December 1st, 2007 3:16 pm

    […] Ensure Matrix is Symmetrical […]