How to create a diagonal matrix that starts at (1,1)?
조회 수: 6 (최근 30일)
이전 댓글 표시
Can someone help me?
How do I create a diagonal matrix of lambda, where lambda = 0.2? I would like the diagonal to start at (1,1).
Any help would be greatly appreciated.
댓글 수: 3
채택된 답변
Star Strider
2021년 11월 21일
Without using repmat —
n = 4;
lambda = 0.2;
A = diag([0 ones(1,n)]*lambda)
,
댓글 수: 0
추가 답변 (2개)
Jan
2021년 11월 21일
Maybe you mean:
n = 4;
lambda = 0.2;
A = eye(n) * lambda
% Or:
A = diag(repmat(lambda, 1, n))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!