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: "Expanding matrices"
Replies: 3   Last Post: Apr 9, 2013 6:41 AM

Advanced Search

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

Watch Watch this User
"Expanding matrices"
Posted: Apr 8, 2013 12:53 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

There may be some very simple function for this I'm unaware of but I'm trying to multiply out matrices as if they were brackets whilst retaining all the terms.

For example

Phase1=[A ;
B]
Phase2=[C , D ;
E, F]
Phase3=[ G;
H;
I]

I'm trying to multiply each of these out so the end result would be
Phases=[A , C, D, G;
A , C, D, H;
A , C, D, I;
A , E, F, G;
A , E, F, H;
A , E, F, I;
B , C, D, G;
B , C, D, H;
B , C, D, I;
B , E, F, G;
B , E, F, H;
B , E, F, I;]

However, there will be an unknown number of 'phases' (matrices) and these will be an unknown number of rows and columns.

Firstly I'm asking is there a simple function to combine two matrices together row by row as I'm sure I can work from there. If not does anyone have any recommendations about how to go about this as my initial thought was it needs an unknown number of 'for' loops. Also some matrices may be getting on for 10^6 in length so any hints on speeding up the code would be appreciated.

If I haven't explained this clearly please let me know!

Thanks,

Jon



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.