We want to create a random 20x20 circulant matrix. Please help!

We want to generate a random 20x20 circulant matrix in MatLab. It should be symmetric. Then we should calculate its eigenvalues. We have no experience and this is our graduation project, so it's important for us. Please help!

 採用された回答

sixwwwwww
sixwwwwww 2013 年 12 月 5 日

0 投票

you can do it as follows:
a = randi(100, 20, 1);
b = [];
for i = 1:20
b = [b, a];
a = circshift(a, 1);
end
disp(b)

3 件のコメント

Ezgi
Ezgi 2013 年 12 月 5 日
Thanks a lot! That was exactly what we need! But also we need to calculate its eigenvalues.:)
sixwwwwww
sixwwwwww 2013 年 12 月 5 日
You are welcome. For eigenvalues and eigenvectors you can see the following link for information:
Emmanuel Ijiga
Emmanuel Ijiga 2016 年 10 月 2 日
編集済み: Andrei Bobrov 2016 年 10 月 2 日
M = 20;
input = randi([0 15], 1, M); %Random Input values between 0 and 15
CM = zeros(M,M); %Initialize Circulant Matrix (CM)
CM(1,:) = input; %place the input values in the first row of CM
for kk = 1:(size(CM,1) - 1)
CM(kk+1,1) = CM(kk,end);
CM(kk+1,2:end) = CM([kk],[1:end - 1])
end

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

質問済み:

2013 年 12 月 5 日

編集済み:

2016 年 10 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by