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.
댓글 수: 4
Guillaume
2020년 3월 14일
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.
Stephen23
2020년 3월 22일
Original question (from Google Cache):
"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
2020년 5월 14일
(Answers Dev) Restored edit
Rena Berman
2020년 10월 12일
(Answers Dev) Restored edit
답변 (2개)
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
Alice Zurock
2020년 3월 12일
Sriram Tadavarty
2020년 3월 12일
Hi Alice,
Sure that can be built up on the function placed in the answer and as suggested in the answer. Here is the snippet that does what is asked for.
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 is a CCK code and report accordingly
cckFlag = false(1,2^n);
for i = 1:2^n
cckFlag(i) = checkCCKCode(bits(i,:));
end
out = bits(cckFlag,:);
end
In command window:
>> getCCKCodes(4)
ans =
1 -1 -1 -1
-1 1 -1 -1
-1 -1 1 -1
1 1 1 -1
-1 -1 -1 1
1 1 -1 1
1 -1 1 1
-1 1 1 1
Let me know if this helps and is the same you asked for.
Regards,
Sriram
Sriram Tadavarty
2020년 3월 12일
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?
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
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
2020년 3월 12일
0 개 추천
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
카테고리
도움말 센터 및 File Exchange에서 WLAN Toolbox에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!