필터 지우기
필터 지우기

Creating a matrix with matrices on the sub and super diagonals

조회 수: 7 (최근 30일)
Eimear Nolan
Eimear Nolan 2013년 4월 25일
Hi! I have two matrices A(identity matrix) and B and I want to make a matrix C where B is on the diagonal for the entire matrix and A is on the sub and super diagonal on the entire matrix.I have tried using the kron command but I want to be able to see separate blocks of the matrices in C. As in I should be able to see a 2 diagonals of all ones in my C matrix. Any help would be appreciated!
  댓글 수: 1
the cyclist
the cyclist 2013년 4월 25일
Your question would be easier to understand if you made a small example.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ahmed A. Selman
Ahmed A. Selman 2013년 4월 25일
Use the command (diag) for creating a (main) diagonal matrix from a vector A, and the command (spdiags) to create sub- and super-diagonal. Kronecker function does not make diagonal matrices, it rather finds the product of two tensors.

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by