Path: news.mathworks.com!not-for-mail
From: "someone " <someone@somewhere.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: variable help
Date: Fri, 9 May 2008 16:30:18 +0000 (UTC)
Organization: Mitre Corp
Lines: 51
Message-ID: <g01u6q$s80$1@fred.mathworks.com>
References: <g01snh$q9j$1@fred.mathworks.com>
Reply-To: "someone " <someone@somewhere.net>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210350618 28928 172.30.248.37 (9 May 2008 16:30:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 May 2008 16:30:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:467619


"Katie " <kmcdon03@uoguelph.ca> wrote in message 
<g01snh$q9j$1@fred.mathworks.com>...
> This is my first time using MATLAB,
> I am using this formula to compute sign patterns of 4x4 
> nilpotent matrices;
> A(n+1)=P*A(n)*inv(P) for n=1,2,3,4, where P is a random 
> matrix and A(1) is the 4x4 jordan. (This formula can be 
> repeated up to n=4 before sign patterns are duplicated, n 
> is the number of times that the random matrix (P) can be 
> used- just a subscript to define the variables). so what 
I 
> did was:
> A2=P*A1*inv(P)  
> A3=P*A2*inv(P)
> A4=P*A3*inv(P)
> A5=P*A4*inv(P)
> 
> I want to loop this until all the possible sign patterns 
> for nilpotent matrices are obtained, changing the random 
> matrix every 4 times. BUT obviously if I were to loop 
this 
> set of equations, for each new P the variables would just 
> be replaced each time since they are named the same. I 
have 
> tried using A(i) or A(n) like in the original equation, 
but 
> it is read as multiplication.

I'm not sure what "read as multiplication" means.  If you 
want element-by-element multiplication instead of matrix 
multiplication replace "*" with ".*" in the above.

> How do I solve this problem? 
> or create some sort of subscript system so that the 
> subscript of the variables change each time.

The short answer is don't do this!  Use cell arrays instead.

You may want to see Q 4.6 in the MATLAB FAQ at:

http:/matlabwiki.mathworks.com/MATLAB_FAQ

 
> THANK YOU! 

There is probably some way to use the MATLAB "sum" command 
(without using a loop) to do what you want.  Try

doc sum

at the MATLAB command promt.