Getting a increasing by the nxn matrix inside a for loop

2 次查看(过去 30 天)
HI there i dont quite understand how to get a matrix that is increasing by nxn matrix
like for example
n=100
for i=1:n
matrixA=[1x1] matrix
iter1
matrixA=[2x2] matrix
iter 2
and so on until the 100x100 matrix, so
end
it would also help if the matrix i get can be used for the diag function?
Help is appreciated thank you in advance

采纳的回答

KSSV
KSSV 2021-3-18
编辑:KSSV 2021-3-18
n=100 ;
matrixA = cell(n,1) ;
for i=1:n
matrixA{i} = rand(n) ;
end
  6 个评论
KSSV
KSSV 2021-3-18
That any is random....
n=100 ;
matrixA = cell(n,1) ;
for i=1:n
matrixA{i} = rand*diag(repmat(i,1,i)) ;
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by