MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   使用Matlab基于向量和对角元素的矩阵= 1 (https://www.labfans.com/bbs/showthread.php?t=23733)

poster 2019-12-10 20:48

使用Matlab基于向量和对角元素的矩阵= 1
 
我如何创建以下矩阵

1 0 0 0 0 k1 1 0 0 0 k2 k1 1 0 0 k3 k2 k1 1 0 k4 k3 k2 k1 1

[B]回答:[/B]

使用[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/toeplitz.html"]TOEPLITZ[/URL] 。

例如

vector = [1 2 3 4 5]; %# replace this with values for [1 k1 k2 k3 k4] out = toeplitz(vector,[1 0 0 0 0]) out = 1 0 0 0 0 2 1 0 0 0 3 2 1 0 0 4 3 2 1 0 5 4 3 2 1 [B]编辑[/B]
[INDENT]我的向量是[k1 k2 k3 k4 k5],我该如何应用tril或toeplitz?

[/INDENT]使用@gnovice的更方便的公式,您可以使用

yourVector = [k1 k2 k3 k4 k5]; tril(toeplitz([1 yourVector(1:4)]))

[url=https://stackoverflow.com/questions/3345236]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 04:55

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.