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