Communication Technology

 

 

 

 

Scrambling

 

Scrambling in communication usually indicates a process to convert a specific sequence to another sequence which is 'random-like' sequence. I am saying 'random-like', not 'random'. It mean it would just look like random, but it is generated by well defined deterministic way and the random-like sequence can be easily removed by a systematic way.

There are different ways for scrambling, but a common way is to generate a specific sequence called Scrambling Sequence and multiply (XOR in binary) it with the data that you want to scramble. As an example, you can see this type of scrambling in WCDMA Scrambling process.

 

A typical method of scrambling is illustrated as below. This is just to visualize the concept of scrambling process. It does not comply with any industrial specification (e.g, 3GPP).

[1] - This is the data that will be scrambled.

[2] - This is just to show that the first 10 % of the data [1], so that you can recognize the pattern more easily.

[3] - This is the sequence that will be used as a scrambler (i.e, scrambling code).

[4] - This is just to show that the first 10 % of the data [3], so that you can recognize the pattern more easily.  

[5] - This is the result of the sequence [1] that has been scrambled by the sequence [3].

[6] - This is just to show that the first 10 % of the data [5], so that you can recognize the pattern more easily.

[7] - This is the descrambled result of the sequence [5] using the scrambling code [7]

[8] - This is just to show that the first 10 % of the data [7], so that you can recognize the pattern more easily

[9] - This shows the result of cross correlation between the scrambled code [7] and the scrambling code [3]

 

 

 

 

Why Scrambling ?

  • One of the most popular reason for scrambling would be to make a given sequence like a random-like sequence. I said 'random-like', not 'real random'. The scrambled sequence should be able to be unscrambled by deterministic / systematic way.
  • By designing a set of scramble code (scrambling sequence) in a specific way, you can use it as a specific identification code for each transmitter. For example, in WCDMA all the physical channel carrying user data from a specific cell is scrambled by a specific scrambling code and this scrambling code can be the identifier of the physical cell that is transmitting the specific user data.

 

 

 

Octave Script

 

 

N1 = 10; % Upsampling Rate

h1_t = ones(1,N1);

bits1 = 2000/N1;

 

N2 = 10; % Upsampling Rate

h2_t = ones(1,N2);

bits2 = 2000/N2;

 

rand ("seed", 102)

sig1 = randi([0 1],[1 bits1]);

sig2 = randi([0 1],[1 bits2]);

 

sig1_zerostuff = zeros(1,length(sig1) * N1);

sig1_zerostuff(1:N1:length(sig1_zerostuff)) = sig1;

sig2_zerostuff = zeros(1,length(sig2) * N2);

sig2_zerostuff(1:N2:length(sig2_zerostuff)) = sig2;

 

sig1_pulse = conv(sig1_zerostuff,h1_t);

sig1_pulse_mod = 2*sig1_pulse-1;

sig1_pulse_fft = circshift(fft(sig1_pulse_mod),floor(length(sig1_pulse_mod)/2));

sig1_pulse_fft = sig1_pulse_fft / max(sig1_pulse_fft);

sig2_pulse = conv(sig2_zerostuff,h2_t);

sig2_pulse_mod = 2*sig2_pulse-1;

sig2_pulse_fft = circshift(fft(sig2_pulse_mod),floor(length(sig2_pulse_mod)/2));

sig2_pulse_fft = sig2_pulse_fft / max(sig2_pulse_fft);  

sig_ss = xor(sig1_pulse(1:2000),sig2_pulse(1:2000));

sig_ss_mod = 2*sig_ss-1;

sig_ss_fft = circshift(fft(sig_ss_mod),floor(length(sig_ss_mod)/2));

sig_ss_fft = sig_ss_fft / max(sig_ss_fft);

sig_ds = xor(sig_ss(1:2000),sig2_pulse(1:2000));

sig_ds_mod = 2*sig_ds-1;

sig_ds_fft = circshift(fft(sig_ds_mod),floor(length(sig_ds_mod)/2));

sig_ds_fft = sig_ds_fft / max(sig_ds_fft);

sig_corr = xcorr(sig_ss,sig2_pulse);

 

subplot(5,3,[1 2]);

plot(sig1_pulse_mod);

xlim([0 length(sig1_zerostuff)]);

ylim([-2 2]);

axis("nolabel");

title("[1] data");

 

subplot(5,3,3);

plot(sig1_pulse_mod);

xlim([0 length(sig1_zerostuff)/10]);

ylim([-2 2]);

axis("nolabel");

title("[2] Initial 10%");

 

subplot(5,3,[4 5]);

plot(sig2_pulse_mod);

xlim([0 length(sig2_zerostuff)]);

ylim([-2 2]);

axis("nolabel")

title("[3] scrambling code");

 

subplot(5,3,6);

plot(sig2_pulse_mod);

xlim([0 length(sig2_zerostuff)/10]);

ylim([-2 2]);

axis("nolabel")

title("[4] Initial 10%");

 

subplot(5,3,[7 8]);

plot(sig_ss_mod);

xlim([0 length(sig_ss)]);

ylim([-2 2]);

axis("nolabel")

title("[5] ss=XOR(data,scramling code)");

 

subplot(5,3,9);

plot(sig_ss_mod);

xlim([0 length(sig_ss)/10]);

ylim([-2 2]);

axis("nolabel")

title("[6] Initial 10%");

 

subplot(5,3,[10 11]);

plot(sig_ds_mod);

xlim([0 length(sig_ds)]);

ylim([-2 2]);

axis("nolabel")

title("[7] dss=XOR(ss,scrambling code)");

 

subplot(5,3,12);

plot(sig_ds_mod);

xlim([0 length(sig_ds)/10]);

ylim([-2 2]);

axis("nolabel")

title("[8] Initial 10%");

 

subplot(5,3,[13 15]);

plot(sig_corr);

xlim([0 length(sig_corr)]);

%ylim([-2 2]);

axis("nolabel")

title("[9] Corr(ss,scrambling code)");

 

 

 

Reference :

 

[1] CDMA Overview

[2] Principles of DS-CDMA