Ensure Matrix is Symmetrical

Written on November 30, 2007 – 10:12 pm | by Keith Neo

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

Comments Map

  1. 1 Trackback(s)

  2. Dec 1, 2007: United States Gallery of posts up to 12-01-2007 from Utah, United States UNITED STATES WordPress 2.0.11

Post a Comment