# Complementary Code Keying ( 802.11b )

조회 수: 21(최근 30일)
Alice Zurock 10 Mar 2020
댓글: Rena Berman 14 May 2020 16:38
How can I find CCK code pairs length N on matlab? For example N = 4.
Check whether [-1 -1 -1 1] obeys the requirements of CCK codes or not.

#### 댓글 수: 3

Guillaume 14 Mar 2020
Note that we really dislike people editing their question away after they've received help (extensive in your case). This is not a private consultancy forum. Questions and their answers are for the benefit of everybody.
It is also pointless, the question will be restored to its original state. All you've done is ensured that you won't be receiving any more help.
Stephen Cobeldick 22 Mar 2020
"Complementary Code Keying ( 802.11b )"
How can I find CCK code pairs length N on matlab? For example N = 4.
Check whether [-1 -1 -1 1] obeys the requirements of CCK codes or not.
Rena Berman 14 May 2020 16:38

로그인 to comment.

### 답변(2개)

Hi Alice,
This piece of code can check if the provided input obeys the CCK codes.
function flag = checkCCKCode(in)
% Returns 1, if obeys the requirement of CCK code
% Get the length of in
N = length(in);
% Perform the circular shift for each location and check if the sum of all the elements of correlation is zero
flag = 1;
for i = 1:N-1
shiftIn = circshift(in,i);
if sum(in.*shiftIn) ~= 0
flag = 0; % Implies input doesn't obey CCK code requirement
end
end
end
In command window,
>> checkCCKCode([-1 -1 -1 1])
ans =
1
Inorder to find all the CCK pairs of length N, you can just pass the inputs in a loop to this minor code and it would indicate what are the inputs that obey CCK codes.
Hope this helps.
Regards,
Sriram

#### 댓글 수: 5

표시 이전 댓글 수: 2
May i know if the third column in the table indicates the matrix multiplication of input Code 1 and shifted code(s). Implies is it code1*1-shifted, code1*2-shifted and so on?
Hi Alice,
I did some further investigation and could figure out what the issue was. Initially, i interpreted the table in a different way. Here are the modified codes, which would help you to find the number of CCK codes for a given length.
function flag = checkCCKCode(in1,in2)
% Returns 1, if both obeys the requirement of CCK code(s)
% Get the length of in
N = length(in1);
s1 = zeros(1,N);
s2 = s1;
for j = 0:N-1
s1(j+1) = sum(in1.*circshift(in1,-j));
s2(j+1) = sum(in2.*circshift(in2,-j));
end
flag = all((s1(2:end)+s2(2:end)) == 0);
end
And then the calling function
function out = getCCKCodes(n)
% Get the possible integer values for the length n
intValue = 0:2^n-1;
% Convert the integer values to binary values
bits = de2bi(intValue);
bits(bits==0) = -1;
% Check if each bit vector(s) obey CCK code(s) and report accordingly
cckFlag = false(2^n,2^n);
for i = 1:2^n
for j = 1:2^n
cckFlag(i,j) = checkCCKCode(bits(i,:),bits(j,:));
end
end
out = nnz(cckFlag);
end
In the command prompt,
try >> getCCKCodes(4)
It provides the output as 64.
The code perform the same as you explained now.
Let me know if this helps.
Regards,
Sriram
Hi Alice,
I will place this answer separately and do accept it so that it will be more accessible and will help the ones who are in need.
Yes, i have experience on C++. If you do have any issue with C++ and integration with MATLAB, please raise a new question.
Thanking you.
Regards,
Sriram

로그인 to comment.

Hi Alice,
Placing the working code separately. The function checkCCKCode will indicate if the provided inputs in1 and in2 satisfy the conditions of CCK code(s) and the function getCCKCodes provides the number of CCK codes possible for the given length N.
function flag = checkCCKCode(in1,in2)
% Returns 1, if both obeys the requirement of CCK code(s)
% Get the length of in
N = length(in1);
s1 = zeros(1,N);
s2 = s1;
for j = 0:N-1
s1(j+1) = sum(in1.*circshift(in1,-j));
s2(j+1) = sum(in2.*circshift(in2,-j));
end
flag = all((s1(2:end)+s2(2:end)) == 0);
end
And then the calling function
function out = getCCKCodes(n)
% Get the possible integer values for the length n
intValue = 0:2^n-1;
% Convert the integer values to binary values
bits = de2bi(intValue);
bits(bits==0) = -1;
% Check if each bit vector(s) obey CCK code(s) and report accordingly
cckFlag = false(2^n,2^n);
for i = 1:2^n
for j = 1:2^n
cckFlag(i,j) = checkCCKCode(bits(i,:),bits(j,:));
end
end
out = nnz(cckFlag);
end
In the command prompt,
try >> getCCKCodes(4)
It provides the output as 64.
Thanking you.
Regards,
Sriram

#### 댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

### 태그

아직 태그를 입력하지 않았습니다.

Translated by