2010-07-31 35 views
1

创建矩阵我如何创建以下矩阵?如何使用向量k = [8 9 6 5 4 3]

[0 0 0 
8 0 0 
9 8 0 
6 9 8 
5 6 9 
4 5 6] 
+1

你保持这种要求的变化[同](http://stackoverflow.com/questions/3345236/matrix -based-on-vector-and-diagonal-elements1-using-matlab)[question](http://stackoverflow.com/questions/3357075/how-can-i-create-a-matrix-using-vector-with -lag-使用-MATLAB)。如果您已阅读[TOEPLITZ](http://www.mathworks.com/access/helpdesk/help/techdoc/ref/toeplitz.html)和[使用矩阵]的文档(http://www.mathworks.com /access/helpdesk/help/techdoc/math/f1-84787.html),你现在应该能够弄清楚这一点。顺便说一句,答案是:'M = toeplitz([0 k(1:5)],[0 0 0]);'。 – gnovice 2010-07-31 22:35:16

回答

1

toeplitz功能如何?

c=[0 8 9 6 5 4 3] 
r=[0 0 0] 
t=toeplitz(c,r) 

(免责声明:未经)

T应当是:

0 0 0 
8 0 0 
9 8 0 
6 9 8 
5 6 9 
4 5 6 
3 4 5 
+0

向量的最后一个元素是3:在我想创建的矩阵中,colomn1中的最后一个元素是4,矩阵顺序是6×3当使用toeplitz(c,r)时,clo1中的最后一个元素= 3和矩阵顺序是7×3我想要一般规则用于模拟 – 2010-07-31 20:55:40

+0

@blue:对不起,我想也许这只是一个错字,“3”丢失。无论如何,toeplitz听起来就像你所需要的;你只需要调整“c”(“column”)参数来生成你正在寻找的输出矩阵。 – 2010-07-31 21:14:55

相关问题