diagonal matrix--diag how to create a diagonal matrix? diag() func. how to get diagonal elements from a matrix? diag() func. [syntax][descr] (1) M=diag(Vector V,int k=0) will return a |V|*|V| diagonal matrix |V| is length of V When k=0, M is |V|*|V| size, M[i,i]=v[i] , M[i,j]=0 , for 1<=i , j <=|V| i!=j , where i and j is positive integer. i.e. value of elements in M which its index belongs diagonal is equal to value of elements in Vector V, otherwise is equal to 0. translation:對角線索引的值為V的元素的值,非對角線索引的值為0 When k>0, M is |V+k|*|V+k| size, M[i+k,i+k]=v[i] ,M[i,j]=0 for 1<=i , j <=|V| i!=j , where i , j and k is positive integer. [extra tips] You can think about M=diag(V), then add a row and column at left and button which all element are equal to 0. translation:你可以想M=diag(V),然後把所有為0的元素加到最左行(第一行)和最下列(最後一列) When k<0, M is |V+k|*|V+k| size, M[i,i]=v[i] ,M[i,j]=0 for 1<=i , j <=|V| i!=j , where i and...
Comments
Post a Comment