Scrambling Function, what I am doing wrong

Hi,
I am trying write a scrambling program,Summary is as follow -Random data -Scrambling function with x^32 polynomial and e being initial states of 32 bit length. -Modulation -Demodulation -DeScrambling,
Now if I compare the output after the deScrambling it matches for first run but failed for rest. I have tried to clear/release the deScrambling handler and all possible solutions which I can think of.
I need to put Scrambling block into my already build physical layer simulation with other coding and modulation schemes. Code below is just test code which fails to return which is expected from deScrambling object
clc
clear all
N = 2;
px=[1,1,1,0,1,1,0,1,1,0,1,1,1,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,1;];
e= [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;];
hSCR = comm.Scrambler(N,px,e);
p=4;
data = randint(p, 5);
for ii=1:p
scrData(ii,:) = step(hSCR, data(ii,:)');
end
hModulator = comm.BPSKModulator;
for ii=1:p
modData(ii,:) = step(hModulator, scrData(ii,:)');
end
hDemod = comm.BPSKDemodulator;
hDSCR = comm.Descrambler(N,px,e);
for ii=1:p
DemodData(ii,:) = step(hDemod, modData(ii,:)');
end
release(hDemod);
hDSCR = comm.Descrambler(N,px,e);
for ii=1:p
deScrData(ii,:) = step(hDSCR, DemodData(ii,:)');
release(hDSCR);
a(ii,:)=isequal(data(ii,:),deScrData(ii,:));
[data(ii,:)' deScrData(ii,:)']
% clear hDSCR;
end
a

댓글 수: 1

Walter Roberson
Walter Roberson 2011년 12월 5일
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup

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

답변 (1개)

Shan
Shan 2011년 12월 5일

0 개 추천

here is simplified version of this code,
uncomment the nested LOOP , which results in Scrambling function to fail, Why?????
clc
clear all
N = 2;
px=[1,1,1,0,1,1,0,1,1,0,1,1,1,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,1;];
e= [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;];
hSCR = comm.Scrambler(N,px,e);
hDSCR = comm.Descrambler(N,px,e);
for jj=1:5
data(jj,:) = randint(1, 4);
scrData(jj,:) = step(hSCR, data(jj,:)');
end
for jj=1:5
% for counter = 1:3 %uncomment this loop and Scrambler fails, WHY?
deScrData = step(hDSCR, scrData(jj,:)');
a(jj)=isequal(data(jj,:)', deScrData);
% end
end
disp(a);

댓글 수: 3

Kaustubha Govind
Kaustubha Govind 2011년 12월 6일
What version are you using? I uncommented the inner loop and was able to run your code successfully on R2011b.
Shan
Shan 2011년 12월 9일
Im using R2011b, But still have this error,
Why on 2nd loop it fails
:-(
Shan
Shan 2011년 12월 12일
I am testing that code on 2011b, When I enable nested loop scrambler fails.
Seems like bug in scrambling block?

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

카테고리

질문:

2011년 12월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by