How do I create a circulant matrix of shift 3 towards the left ?

Hi,
Does anyone know how do I create a circulant matrix like the one I attached. The first 2 row is for the x-axis, center 2 row is for the y-axis and the last 2 row is for the z-axis. The shift from each row is 3. The x-axis started from 1st column. The y-axis started from 2nd column and the z-axis started from 3rd column.

댓글 수: 1

Given your description, I fail to see how the 3rd row is looking in A. Or has A only six rows? And should it be flexible somehow?

댓글을 달려면 로그인하십시오.

 채택된 답변

Jos (10584)
Jos (10584) 2013년 12월 16일
편집: Jos (10584) 2013년 12월 16일
Not very flexible:
A = eye(6)
A = A([1 4 2 5 3 6],:) % permute as desired
A(:,10) = 0 % add some zero columns

댓글 수: 3

Derick Wong
Derick Wong 2013년 12월 16일
편집: Derick Wong 2013년 12월 16일
That was useful. But however, there is actually 93 column and 93 row. So I guess I can't permute all the of the rows and column. So I think I need a circulant.
31 rows and 93 column for x-axis, 31 rows and 93 column for y-axis and 31 rows and 93 columns for z-axis. Apologize for not stating the question clearly.
You could help by stating what the third line of A should be:
A = [1 0 0 0 0 0 0 0 . . . line 1
0 0 0 1 0 0 0 0 . . . line 2
WHAT IS HERE!
0 1 0 0 0 0 0 0 line 32
Is abit tedious when I did it. But it surely works. A= eye(93,93); A=A([1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93],:);
Many thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Matt J
Matt J 2013년 12월 16일
편집: Matt J 2013년 12월 16일
Using FUNC2MAT
A=func2mat(@(x)circshift(x,3),zeros(93,1));
Jos (10584)
Jos (10584) 2013년 12월 16일
It does look like a row-permuted circulant
N = 31 ;
dn = 3 ;
A = eye(dn*N) ; % circulant
ix = ones(N,d) ; % make a permution index
ix(1,:) = 1+dn*(0:N-1) ;
ix = cumsum(ix,1) ;
ix = ix.' ;
A = A(ix,:) % row-permutation

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2013년 12월 16일

댓글:

2013년 12월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by