fdiag [fixed]
— Loadable Function: fdiag (v, k)

Return a diagonal matrix with fixed point vector v on diagonal k. The second argument is optional. If it is positive, the vector is placed on the k-th super-diagonal. If it is negative, it is placed on the -k-th sub-diagonal. The default value of k is 0, and the vector is placed on the main diagonal. For example,

          fdiag (fixed(3,2,[1, 2, 3]), 1)
          ans =
          
            0.00  1.00  0.00  0.00
            0.00  0.00  2.00  0.00
            0.00  0.00  0.00  3.00
            0.00  0.00  0.00  0.00

Note that if all of the elements of the original vector have the same fixed point representation, then the zero elements in the matrix are created with the same representation. Otherwise the zero elements are created with the equivalent of the fixed point value fixed(0,0,0).n

See also: diag