Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Solve Matrix Equation AX=XB, Clarification
Replies: 6   Last Post: Jul 18, 2013 2:32 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,945
Registered: 12/7/04
Re: Solve Matrix Equation AX=XB, Clarification
Posted: Jul 17, 2013 5:50 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Jeremy " <jlawrence6809@gmail.com> wrote in message
> I'm doing a school project with a vector network analyzer and gathering
> data on four adapters which I'll call a,b,c,d. Each of these devices can
> be characterized with a 2x2 matrix, and when you multiply these matrices
> together you get a 2x2 matrix that characterizes these adapters hooked
> together. I am hooking the adapters up in the configurations a-c-b and
> a-d-b which gives the resultant 2x2 matrices that I'll call s and t. I
> know the characteristic matrices for c and d but not a and b, and it is my
> goal to solve for them. So the resulting equations look like the
> following:


> To see if the equations given in this thread would work for me I created
> dummy values for [a],[b],[c], and [d], used them to solve for [s] and [t],
> and used them with the equations given to see if they would give me back
> [a]. The matlab code is the following:
> %initial values
> a =[2, 3;5, 7];
> b =[11 , 13;17 , 19];
> c =[23 , 29;31 , 37];
> d =[41 , 43;47 , 53];
> %setup
> s = av*c*b;

I assume this was supposed to be a*c*b?

> t = a*d*b;
> A = s/t;
> B = c/d;

For A*X = X*B, one solution is the appropriately sized zero matrix. This is
the solution the LYAP function in Control System Toolbox returns.


> %calculate
> n = length(A);
> G = kron(eye(n),A)-kron(B.',eye(n));
> x = null(G)

NULL gives _A_ basis for the nullspace of G. You can check that it gives you
a solution of your system of equations:

xv = reshape(x(:, 1), [2 2]);

The difference seems pretty small to me, smaller even than A*a-a*B.

> I do not however get the expected result for [a]! Is it a problem of not
> having an initial value or something like that? I have a few more
> measurements I could make to introduce an initial value but from there I'm
> not sure how to combine these equations.

You're assuming uniqueness. Since you wrote your equation in the form
A*X=X*B, your B is the negative of the B using the form in the Wikipedia


So your equation has a unique solution if and only if your A and B have no
common eigenvalues. It looks to me like they have two (out of two)
eigenvalues that are pretty darn close to being the same.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.