Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to create a matrix from a quarter matrix using symmetry

As an instance I have a matrix like this:

A = [1 2;
     3 4]

The matrix A is the quarter of a matrix, the full matrix B can be obtained by mirroring A on the vertical and horizontal mirror axes. The resullt should be:

B =     [1 2 2 1;
         3 4 4 3;
         3 4 4 3;
         1 2 2 1]

How can I achive this in Matlab?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Edit: Is there a better way than

Q = [A fliplr(A)]
B = [Q ; flip(Q)]

?

>Solution :

You could do it in a single line, although "better" is slightly subjective

B = [A, fliplr(A); flipud(A), rot90(A,2)]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading