Upper triangular matrix

Hi,

what is the most efficient way of creating an upper triangular matrix?

Thanks

Pablo

1 Answer



1



accepted

If you are starting with an Nx1 vector you could use the xpnd and upmat functions like this:

d = { 1, 2, 3, 4, 5, 6 };
d_upper = upmat(xpnd(d));

d_upper =

   1    2    4 
   0    3    5 
   0    0    6 

Your Answer

1 Answer

1
accepted

If you are starting with an Nx1 vector you could use the xpnd and upmat functions like this:

d = { 1, 2, 3, 4, 5, 6 };
d_upper = upmat(xpnd(d));

d_upper =

   1    2    4 
   0    3    5 
   0    0    6 

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.