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: Arranging even and odd numbers
Replies: 3   Last Post: Feb 21, 2013 1:15 AM

Advanced Search

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

Posts: 12
Registered: 10/30/12
Arranging even and odd numbers
Posted: Feb 20, 2013 10:50 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have a vector
x=[0 1 2 3 4 5 6 7]
and I want to creat x' from x such that
x'=[0 2 4 6 1 3 5 7]
This can be achieved by following transformation
A*x=x'

where

A=[1 0 0 0 0 0 0 0;
0 0 1 0 0 0 0 0;
0 0 0 0 1 0 0 0;
0 0 0 0 0 0 1 0;
0 1 0 0 0 0 0 0;
0 0 0 1 0 0 0 0;
0 0 0 0 0 1 0 0;
0 0 0 0 0 0 0 1]

How can I generate matrix A without getting into for loops.



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.