Fast question!

조회 수: 9 (최근 30일)
Feruz
Feruz 2011년 11월 28일
Hi all,
How do I make this matrix in Matlab?
Thanks
  댓글 수: 1
Image Analyst
Image Analyst 2011년 11월 28일
Fast comment - what number should be in the blank areas?

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

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 28일
If the output matrix is to be n by n, then
M = diag(ones(m-1,1),1) + diag(-ones(m-1,1),-1) + diag(1,1-n) + diag(1,n-1);
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 11월 28일
There are faster ways using ordinary assignments.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by