Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to solve implicit linear matrix equation

Subject: how to solve implicit linear matrix equation

From: Norbert Fogarasi

Date: 9 Nov, 2010 10:54:04

Message: 1 of 8

This one feels simple, but I haven't been able to find an answer...

Trying to solve the implicit matrix equation

X=Y'*X*Y+C for X

where X is nxn unknown
Y and C nxn known matrices

I know I can write a function for the above that returns the norm of Y'*X*Y+C-X and solve numerically (fsolve or fzero...), but given that this is perfectly linear, I wonder if there is an analytical way of doing it...

Thanks:
Norbert

Subject: how to solve implicit linear matrix equation

From: Bruno Luong

Date: 9 Nov, 2010 11:56:08

Message: 2 of 8

X=rand(3)
Y=rand(3)
C=X-Y'*X*Y

% Engine
M = speye(numel(Y))-kron(speye(size(Y)),Y')*kron(Y.',speye(size(Y)));
X = reshape(M\C(:),size(Y))

Subject: how to solve implicit linear matrix equation

From: Torsten Hennig

Date: 9 Nov, 2010 12:04:45

Message: 3 of 8

> This one feels simple, but I haven't been able to
> find an answer...
>
> Trying to solve the implicit matrix equation
>
> X=Y'*X*Y+C for X
>
> where X is nxn unknown
> Y and C nxn known matrices
>
> I know I can write a function for the above that
> returns the norm of Y'*X*Y+C-X and solve numerically
> (fsolve or fzero...), but given that this is
> perfectly linear, I wonder if there is an analytical
> way of doing it...
>
> Thanks:
> Norbert

http://en.wikipedia.org/wiki/Lyapunov_equation

Best wishes
Torsten.

Subject: how to solve implicit linear matrix equation

From: PLH

Date: 9 Nov, 2010 12:44:08

Message: 4 of 8

For an analytic approach...

Does Y have any particular symmetries/properties? I.e., is it Hermitian, symmetric, unitary, singular etc. ?

Subject: how to solve implicit linear matrix equation

From: Norbert Fogarasi

Date: 9 Nov, 2010 13:23:04

Message: 5 of 8

Many thanks for the quick responses - it's exactly what I was after....

I'm still trying to reconcile Bruno's code (which seems to work perfectly) with the Lyapunov equation that Torsten kindly directed me towards...

(can't quite figure out how taking the matrix product of pre- and post-multiplying Y' with identity get us to the right place when we should be kron multiplying Y with Y')

Thanks again:
Norbert

Subject: how to solve implicit linear matrix equation

From: Steven_Lord

Date: 9 Nov, 2010 14:54:21

Message: 6 of 8



"Norbert Fogarasi" <norbert.fogarasi@morganstanley.com> wrote in message
news:ibb98c$1v1$1@fred.mathworks.com...
> This one feels simple, but I haven't been able to find an answer...
>
> Trying to solve the implicit matrix equation
>
> X=Y'*X*Y+C for X
>
> where X is nxn unknown
> Y and C nxn known matrices
>
> I know I can write a function for the above that returns the norm of
> Y'*X*Y+C-X and solve numerically (fsolve or fzero...), but given that this
> is perfectly linear, I wonder if there is an analytical way of doing it...

Look at DLYAP from Control System Toolbox.

http://www.mathworks.com/help/toolbox/control/ref/dlyap.html

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: how to solve implicit linear matrix equation

From: Matt J

Date: 9 Nov, 2010 16:19:04

Message: 7 of 8

"Norbert Fogarasi" <norbert.fogarasi@morganstanley.com> wrote in message <ibbhvo$ndh$1@fred.mathworks.com>...
>
> (can't quite figure out how taking the matrix product of pre- and post-multiplying Y' with identity get us to the right place when we should be kron multiplying Y with Y')
=======

They are equivalent, due to the identity

kron(A1,B1)*kron(A2,B2)=kron(A1*A2,B1*B2)

However, solutions using kron() will hit memory limits for
larger n (on my machine for n=80 or so).

According to Torsten's link, the Lyapunov equation is often applied with Y symmetric. If this is your situation, a much more efficient way to solve this is using this KronProd tool,

http://www.mathworks.com/matlabcentral/fileexchange/25969-efficient-object-oriented-kronecker-product-manipulation

The following compares this with the kron() approach for n=60.


n=60;

%simulated data
Xtrue=rand(n);
Y=rand(n);
  Y=Y+Y';
C=Xtrue-Y'*Xtrue*Y;


    
tic;

 M = speye(numel(Y))-kron(speye(size(Y)),Y')*kron(Y.',speye(size(Y)));
 X = reshape(M\C(:),size(Y));
 
toc
%Elapsed time is 3.394104 seconds.


tic;

K=KronProd({Y'},[1,1]);
[V,D]=eig(K);
D=speye(size(D)) - sparse(D);
X=reshape( V*(D\(V'*C(:) )) ,n,n);

toc;
%Elapsed time is 0.007742 seconds.

Subject: how to solve implicit linear matrix equation

From: Matt J

Date: 9 Nov, 2010 17:18:04

Message: 8 of 8

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ibbs9n$puf$1@fred.mathworks.com>...
>
> According to Torsten's link, the Lyapunov equation is often applied with Y symmetric.
=======

Hmm. Guess I read that wrong. Nothing about A being assumed symmetric (though C is).

Tags for this Thread

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.

Contact us