Matrix transform due to reorder of the equation row number, for AX=b

Hi,
I'd like to solve equation AX=b, e.g., [a11, a12, a13; a21, a22, a23; a31, a32, a33]*{x1, x2, x3}'={b1,b2,b3}'
However, I'd like to reorder X vector by {x2, x1, x3}', so is there any matlab code can do the row and column transform for matrix A?
Thanks.

3 Comments

David commented
i.e., is there any matlab code can get a transformation matrix B, then the transformed one can be calculated by C=A*B?
I have to reorder elements of vector x and b, so rows and columns of A should be switched.

Sign in to comment.

 Accepted Answer

A= A(:,[2 1 3])
b=b([2 1 3])

5 Comments

Hi Azzi, it seems that your code is not correct.
Sorry
b should not change. just change
A= A(:,[2 1 3])
Yes, Azzi, Thanks for your kind help.
Hi Azzi, how A should be changed if elements of b should also be switched as b=b([2 1 3])
You change only A, but this time you change the rows order
A=A([2 1 3],:)

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!