Turn it into Wilkinson's test matrix (see gallery): This example generates a sparse tridiagonal representation of the classic second difference operator on n points. They are not referenced when B is input and are set to zero when B is output.Įxample 1. Some elements of B, corresponding to positions outside of A, are not defined by these loops. The spdiags function deals with three matrices, in various combinations, as both input and output.Īn m-by- n matrix, usually (but not necessarily) sparse, with its nonzero or specified elements located on p diagonals.Ī min(m,n)-by- p matrix, usually (but not necessarily) full, whose columns are the diagonals of A.Ī vector of length p whose integer components specify the diagonals in A. If a column of B is longer than the diagonal it's replacing, spdiags takes elements of super-diagonals from the lower part of the column of B, and elements of sub-diagonals from the upper part of the column of B. The output is sparse.Ĭreates an m-by- n sparse matrix by taking the columns of B and placing them along the diagonals specified by d. Replaces the diagonals specified by d with the columns of B. d is a vector of length p whose integer components specify the diagonals in A. B is a min(m,n)-by- p matrix whose columns are the p nonzero diagonals of A. Four different operations, distinguished by the number of input arguments, are possible:Įxtracts all nonzero diagonals from the m-by- n matrix A. The spdiags function generalizes the function diag. Spdiags (MATLAB Functions) MATLAB Function ReferenceĮxtract and create sparse band and diagonal matrices
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |