我试图在Matlab中创建一个波段matriz,对于matrix_size =6和band_width =1,应该是这样的:
[1,1,0,0,0,0]
[1,2,2,0,0,0]
[0,2,3,3,0,0]
[0,0,3,4,4,0]
[0,0,0,4,5,5]
[0,0,0,0,5,6]
值应该是这样的。我做了功能,这给了我结果:
[1,1,0,0,0,0]
[1,1,1,0,0,0]
[0,1,1,1,0,0]
[0,0,1,1,1,0]
[0,0,0,1,1,1]
[0,0,0,0,1,1]
我的职能代码:
function M=bandmatrix(n,r)
% n -- matri