Resources

Upper triangular matrix

0

Hi,

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

Thanks

Pablo

Tags: asked June 11, 2013
pvg
2

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