필터 지우기
필터 지우기

Create a matrix with non zero entries on the diagonal and subdiagonal and zero elsewhere

조회 수: 2 (최근 30일)
I am confused on how to generate a 4 by 4 matrix which has ones on the diagonal and zeroes on the lower subdiagonal right beneath the diagonal and 2s on the subdiagonal right above the diagonal. In addition, there should be 0 entries elsewhere.

답변 (1개)

David Hill
David Hill 2021년 3월 4일
eye(4)+diag([2 2 2],1);

카테고리

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