Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Lower Triangle for a matirx

Subject: Lower Triangle for a matirx

From: roya olyazadeh

Date: 20 May, 2010 18:31:04

Message: 1 of 4

I have lower triangle data for my matrix :

V 1 .000000000000000E+00
V 2 .000000000000000E+00
V 3 .226602567955182E-04
V 4 .000000000000000E+00
V 5 .217013459933256E-04
V 6 .214709892952333E-04
V 7 .000000000000000E+00
V 8 .109994820796852E-04
V 9 .106655669607930E-04
V 10 .591407360765137E-05
V 11 .000000000000000E+00
V 12 .107742426056467E-04
V 13 .104264693273421E-04
V 14 .532949866175648E-05
V 15 .547875949738045E-05



I want to rearrange them again into matrix format like this :
Lower triangle :


0
0 .226602567955182E-04
0 .217013459933256E-04 .214709892952333E-04
0 .109994820796852E-04 .106655669607930E-04 .591407360765137E-05
0 .107742426056467E-04 104264693273421E-04 .532949866175648E-05 .54E-05

Does any one know what is the solution ?

Subject: Lower Triangle for a matirx

From: Matt Fig

Date: 20 May, 2010 19:34:04

Message: 2 of 4

For example:


A = randperm(15)
B = tril(ones(5));
B(logical(B)) = A

Subject: Lower Triangle for a matirx

From: Roger Stafford

Date: 20 May, 2010 21:37:03

Message: 3 of 4

"Matt Fig" <spamanon@yahoo.com> wrote in message <ht42rc$c4c$1@fred.mathworks.com>...
> For example:
>
>
> A = randperm(15)
> B = tril(ones(5));
> B(logical(B)) = A
- - - - - - - -
  I have modified yours a bit, Matt. I think the size and order were wrong for what was apparently requested.

A = rand(15,1);
B = triu(ones(6));
B(logical(B)) = A;
B = B.';

Roger Stafford

Subject: Lower Triangle for a matirx

From: Matt Fig

Date: 20 May, 2010 22:17:04

Message: 4 of 4

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message - - - -
> I have modified yours a bit, Matt. I think the size and order were wrong for what was apparently requested.
>
> A = rand(15,1);
> B = triu(ones(6));
> B(logical(B)) = A;
> B = B.';
>
> Roger Stafford

Oh, ok. I just meant to give a general example of dealing with triangular matrix indexing, and not address the OP's particulars. Thanks though!

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us