Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Matrix Equation solving

Subject: Matrix Equation solving

From: shameer koya

Date: 14 Nov, 2007 07:45:31

Message: 1 of 5

Please help me to solve the equation

A'pA-p = -I

A - 3x3 matrix
p - 3x3 unknown symetric matrix
I - identity matrix

Subject: Re: Matrix Equation solving

From: Roger Stafford

Date: 17 Nov, 2007 17:57:57

Message: 2 of 5

"shameer koya" <assigmenteee@yahoo.co.in> wrote in message <fhe92r$m23
$1@fred.mathworks.com>...
> Please help me to solve the equation
>
> A'pA-p = -I
>
> A - 3x3 matrix
> p - 3x3 unknown symetric matrix
> I - identity matrix
----------
This is, after all, a set of nine linear equations in the nine unknown elements of
p, and can therefore be solved by matlab using standard techniques with the
backslash operator, with p temporarily considered a 9 x 1 column matrix. It is
only necessary to determine the 81 elements of the corresponding 9 x 9 matrix.

Assuming there is a unique solution, the above equation is of such a nature that
the matrix p is guaranteed be Hermitian symmetric.

Roger Stafford

Subject: Re: Matrix Equation solving

From: Roger Stafford

Date: 19 Nov, 2007 19:24:53

Message: 3 of 5

"Roger Stafford" <eleanorandrogerxyzzy@mindspring.com.invalid> wrote in
message <fhna35$9u4$1@fred.mathworks.com>...
> "shameer koya" <assigmenteee@yahoo.co.in> wrote in message <fhe92r
$m23
> $1@fred.mathworks.com>...
> > Please help me to solve the equation
> >
> > A'pA-p = -I
> >
> > A - 3x3 matrix
> > p - 3x3 unknown symetric matrix
> > I - identity matrix
> ----------
> This is, after all, a set of nine linear equations in the nine unknown
elements of
> p, and can therefore be solved by matlab using standard techniques with
the
> backslash operator, with p temporarily considered a 9 x 1 column matrix.
It is
> only necessary to determine the 81 elements of the corresponding 9 x 9
matrix.
>
> Assuming there is a unique solution, the above equation is of such a nature
that
> the matrix p is guaranteed be Hermitian symmetric.
--------
  Shameer, I was too lazy Saturday to work out matlab code for automatically
determining those 81 matrix elements I described as necessary in solving
your problem, but now I have done so. Given your 3 x 3 matrix, A, do this:

 D = -eye(3);
 X = repmat(A',3,3);
 Y = reshape(repmat(reshape(repmat(A.',3,1),1,27),3,1),9,9);
 Z = X.*Y-eye(9); % Here is the desired 9 x 9 matrix
 P = reshape(Z\D(:),3,3); % <-- This is the 3 x 3 solution

  Note that the repeated 'reshapes' and 'repmats' used in generating matrix Y
above, perform a variant of the 'repmat' operation. Each individual element
of A is replicated so as to form a local 3 x 3 section of copies, rather than the
entire A being replicated as nine 3 x 3 copies. There may well be a better
way of accomplishing this but I couldn't think of it.

Roger Stafford

Subject: Re: Matrix Equation solving

From: Bruno Luong

Date: 19 Nov, 2007 21:27:19

Message: 4 of 5

Alternative solution:

D=-eye(3);
Z=zeros(3);
BIGA1=[A Z Z; Z A Z; Z Z A]';
BIGA2=reshape(permute(reshape(BIGA1,3,3,3,3),[2 1 4 3]),9,9);
P=reshape((BIGA1*BIGA2-eye(9))\D(:),3,3)

;-)
Bruno

Subject: Re: Matrix Equation solving

From: Roger Stafford

Date: 20 Nov, 2007 01:37:24

Message: 5 of 5

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in
message <fhsnu5$hg7$1@fred.mathworks.com>...

> Shameer, I was too lazy Saturday to work out matlab code for
automatically
> determining those 81 matrix elements I described as necessary in solving
> your problem, but now I have done so. Given your 3 x 3 matrix, A, do this:
>
> D = -eye(3);
> X = repmat(A',3,3);
> Y = reshape(repmat(reshape(repmat(A.',3,1),1,27),3,1),9,9);
> Z = X.*Y-eye(9); % Here is the desired 9 x 9 matrix
> P = reshape(Z\D(:),3,3); % <-- This is the 3 x 3 solution
> .....
------
Here is another alternative that I ought to have thought of before:

 D = -eye(3);
 I = floor((3:11)/3);
 Z = repmat(A',3,3).*A(I,I).'-eye(9);
 P = reshape(Z\D(:),3,3);

Roger Stafford

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics