Complementary Code Keying ( 802.11b )

조회 수: 5 (최근 30일)
Alice Zurock
Alice Zurock 2020년 3월 10일
댓글: Rena Berman 2020년 10월 12일
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.
  댓글 수: 4
Rena Berman
Rena Berman 2020년 5월 14일
(Answers Dev) Restored edit
Rena Berman
Rena Berman 2020년 10월 12일
(Answers Dev) Restored edit

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

답변 (2개)

Sriram Tadavarty
Sriram Tadavarty 2020년 3월 12일
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
Sriram Tadavarty
Sriram Tadavarty 2020년 3월 12일
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
Sriram Tadavarty
Sriram Tadavarty 2020년 3월 12일
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

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


Sriram Tadavarty
Sriram Tadavarty 2020년 3월 12일
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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by