simualting the spreading using Walsh Codes

14 views (last 30 days)
Anne
Anne on 5 May 2012
A = [-1 -1 1 1]; B = [-1 1 -1 1]; C = [1 1 -1 -1];
% Generating the code and its timing sequence:
N = 4; H = hadamard(N);
cA = H(2,:); cB = H(3,:); cC = H(4,:);
% Number of samples per chip: Tc_samp = ones(1,4);
codeA = []; codeB = []; codeC = [];
for k = 1 : length(cA)
codeA = [codeA cA(k)*Tc_samp];
codeB = [codeB cB(k)*Tc_samp];
codeC = [codeC cC(k)*Tc_samp];
end
% Generation of Tx Data:
Tx_data = [];
for k = 1 : length(A)
uA = A(k)*codeA;
uB = B(k)*codeB;
uC = C(k)*codeC;
Tx_data = [Tx_data uA+uB+uC];
end
NN = length(Tx_data)
uAb = []; uBb = []; uCb = [];
for k = 1 : NN / 16
index = (k - 1)*NN/4 + 1 : k*NN/4;
uAb = [uAb sum(Tx_data(index).*codeA)];
uBb = [uBb sum(Tx_data(index).*codeB)];
uCb = [uCb sum(Tx_data(index).*codeC)];
end uAb % Error:
res1 = A-uAb/16;
res2 = B-uBb/16;
res3 = C-uCb/16;
i am unable to understand this code , help me in understanding every statement of this code.

Answers (0)

Categories

Find more on Large Files and Big Data in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!