Circulant Matrix [Column Wise Traversal]

4 ビュー (過去 30 日間)
Tarek Hajj Shehadi
Tarek Hajj Shehadi 2020 年 9 月 18 日
コメント済み: Rena Berman 2020 年 10 月 8 日
Below is the row wise circulant matrix algorithm :
function C= circulant(x)
n=length(x);
C=zeros(n,n);
C(1,:)=x;
for i=2:n
C(i, :)=[C(i-1, n) C(i-1, 1:n-1)];
end
How can I compute the circulant matrix column wise based on what I wrote for the circulant matrix computed row wise?
  4 件のコメント
Rik
Rik 2020 年 9 月 20 日
Tarek, removing you question and comments is very rude. I have restored some of your posts from the cache that Google creates. Why did you remove it? Are you afraid to be caught cheating? There is a reason you can't delete a question once you get an answer: people put in time to understand your problem, find a solution, and post it. The curteous thing to is to leave it up so future people with a similar problem can benefit from that time investment as well.
Rena Berman
Rena Berman 2020 年 10 月 8 日
(Answers Dev) Restored edit

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

採用された回答

Bruno Luong
Bruno Luong 2020 年 9 月 19 日
function C= circulant(x)
n=length(x);
C=zeros(n,n);
C(:,1)=x;
for j=2:n
C(:,j)=[C(n,j-1); C(1:n-1,j-1)];
end
  1 件のコメント
Rik
Rik 2020 年 9 月 20 日
Deleted comment by by Tarek Hajj Shehadi:
I have accepted your answer as it is the one I am looking for, I would also like to thank Matt J for also putting an effort in helping me. As for your answer its entirley what I was looking for just that I added C=C'; to transpose this matrix as required.

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

その他の回答 (3 件)

Matt J
Matt J 2020 年 9 月 18 日
function C= circulant(x)
n=length(x);
C=zeros(n,n);
C(1,:)=x;
for i=2:n
C(i, :)=[C(i-1, n) C(i-1, 1:n-1)];
end
C=C.';
  1 件のコメント
Rik
Rik 2020 年 9 月 20 日
Deleted comment by by Tarek Hajj Shehadi:
Hello, The thing I was trying to make columnwise computation and the rowwise computation of the circulant matrix output the same matrix where in both cases, the entries are in same position so the problem I am encountering is perhaps in the for loop.

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


Bruno Luong
Bruno Luong 2020 年 9 月 19 日
function C= circulant(x)
n = length(x);
C = x(mod((1:n)'-(1:n),n)+1);

Bruno Luong
Bruno Luong 2020 年 9 月 18 日
function C= circulant(x)
toeplitz(x,circshift(flip(x),1))
end
  1 件のコメント
Rik
Rik 2020 年 9 月 20 日
Deleted comment by by Tarek Hajj Shehadi:
I wish to write the algorithm using for loops and not use the builtin function.

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by