フィルターのクリア

How to create an Nn x Nn matrix from N number of matrices of n x n size each?

6 ビュー (過去 30 日間)
Richa Dubey
Richa Dubey 2022 年 4 月 8 日
コメント済み: Richa Dubey 2022 年 4 月 8 日
Here Xv is a 3x3 size matrix, A is a 3x3 matrix and samples = 1000 . I wish to create a 3000X3000 size matrix sigma by taking product of Xv and A and then putting the so obtained 3x3 matrix into the huge matrix of this form. I was trying this but it didnt work.
for i=1:1:samples/3
for j=1:1:samples/3
if i==j
sigma(i,j)=Xv(:,i);
elseif i<j
sigma(i,j)=Xv(:,i)*(A^(j-i))';
else
sigma(i,j)=A^(i-j)*Xv(:,i);
end
end
end

採用された回答

KSSV
KSSV 2022 年 4 月 8 日
m = fix(samples/3) ;
signma = cell(m) ;
for i=1:m
for j=1:m
if i==j
sigma{i,j}=Xv(:,i);
else
sigma{i,j}=A*Xv(:,i);
end
end
end
  1 件のコメント
Richa Dubey
Richa Dubey 2022 年 4 月 8 日
Adding cell2mat(sigma) at the end completed the code. It worked! Thanks a lot!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by