738 CHAPTER 12: Applications of Discrete-Time Signals and Systems
n Robustness to interference from other users:Assuming no noise or jammer, if the received baseband
signal comes from two users—that is,
ˆr(t)=m 1 (t)c 1 (t)+m 2 (t)c 2 (t) (12.25)
where the codesc 1 (t)andc 2 (t)are the corresponding codes for the two users, andm 1 (t)andm 2 (t)
their messages. At the receiver of user 1, despreading using codec 1 (t)we get
ˆr(t)c 1 (t)=m 1 (t)c^21 (t)+m 2 (t)c 2 (t)c 1 (t)≈m 1 (t) (12.26)
since the codes are generated so thatc^21 (t)=1 andc 1 (t)andc 2 (t)are not correlated. Thus, we
detect the message corresponding to user 1. The same happens when there is interference from
more than one user.
Simulation of direct sequence spread spectrum. In this simulation we consider that the mes-
sage is randomly generated and that the spreading code is also randomly generated (our code does
not have the same characteristics as the one used to generate the code for spread-spectrum systems).
To generate the train of pulses for the message and the code we use filters of different length (recall the
spreading code changes more frequently than the message). The spreading makes the transmitting
signal have a wider spectrum than that of the message (see Figure 12.13).
The binary transmitting signal modulates a sinusoidal carrier of frequency 100 Hz. Assuming the
communication channel does not change the transmitted signal and perfect synchronization at the
analog receiver is possible, the despread signal coincides with the sent message. In practice, the effects
of multipath in the channel, noise, and possible jamming would not make this possible.
%%%%%%%%%%%%%%%%
% Simulation of
% spread spectrum
%%%%%%%%%%%%%%%%
clear all; clf
% message
m1 = rand(1,12)>0.9;m1 = (m1-0.5)∗2;
m = zeros(1,00);
m(1:9:100) = m1
h = ones(1,9);
m = filter(h,1,m);
% spreading code
c1 = rand(1,25)>0.5;c1 = (c1-0.5)∗2;
c = zeros(1,100);
c(1:4:100) = c1;
h1 = ones(1,4);
c = filter(h1,1,c);
Ts = 0.0001; t = [0:99]∗Ts;
s = m.∗c;
figure(1)