The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

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 ;
Phase2=[C , D ;
E, F]
Phase3=[ G;

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!



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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.