Define matrix in MATLAB with 0s and 1s

2 ビュー (過去 30 日間)
Shirish
Shirish 2014 年 3 月 2 日
コメント済み: Pourya Alinezhad 2014 年 3 月 2 日
I have never use MATLAB before but I have to do one operation that deal with matrix of 25(row) x 25(col). So I don't want to do this by hand. So I have to use matlab.
I want to define matrix in MATLAB of GF(2) (the Galois field of order 2 is a mathematical structure called a field that provides a formal definition of arithmetic modulo two) .
Following is my matrix
1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1
Now I want to find the NULL SPACE of the above matrix. I know the NULL Space of the above matrix is
[1 0 1 0 1 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 1 0 1 0 1]
[0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0]
How to do this operation in MATLAB? In short how to define the matrix with GF(2) and also to find the NULL SPACE of that matrix ?

回答 (1 件)

Pourya Alinezhad
Pourya Alinezhad 2014 年 3 月 2 日
編集済み: Pourya Alinezhad 2014 年 3 月 2 日
define a vector as :
a= [1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ];
you can see the matrix raw's are circularly shifted copies of this vector
for i=1:25
H(i,:)=circshift(a,[0 i-2]);
end
the H matrix is just the one you need... then use a subspace base decomposition method to find the Null space... for example egn() or svd() functions can help u... i am an electrical and communications eng and i know what u exactly need... hope to be helpful.
  2 件のコメント
Shirish
Shirish 2014 年 3 月 2 日
編集済み: Shirish 2014 年 3 月 2 日
The matrix H I am getting is incorrect. I am getting below H
Columns 1 through 21
1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
1 0 0 0
1 1 0 0
1 1 1 0
0 1 1 1
0 0 1 1
Pourya Alinezhad
Pourya Alinezhad 2014 年 3 月 2 日
so the work is finished... just type :
z=null(H);

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

カテゴリ

Help Center および File ExchangeError Detection and Correction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by