Complementary Code Keying ( 802.11b )

7 Ansichten (letzte 30 Tage)
Alice Zurock
Alice Zurock am 10 Mär. 2020
Kommentiert: Rena Berman am 12 Okt. 2020
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 Kommentare
Rena Berman
Rena Berman am 14 Mai 2020
(Answers Dev) Restored edit
Rena Berman
Rena Berman am 12 Okt. 2020
(Answers Dev) Restored edit

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Sriram Tadavarty
Sriram Tadavarty am 12 Mär. 2020
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 Kommentare
Sriram Tadavarty
Sriram Tadavarty am 12 Mär. 2020
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 am 12 Mär. 2020
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

Melden Sie sich an, um zu kommentieren.


Sriram Tadavarty
Sriram Tadavarty am 12 Mär. 2020
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

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by