Thread Subject: signal propagation time and pilot signal acquisition

Subject: signal propagation time and pilot signal acquisition

From: Md.Humayun Kabir

Date: 14 Aug, 2009 18:48:03

Message: 1 of 1


Hello, I am trying to simulate the Pilot channel acquisition in IS-95 CDMA system. Could you please give me any suggestion how I can make delay 17 nsec of transmitted signal. So that signal could propagate arround 5 meter distance.

In my m-file simulation(stated bellow), I consider 1 sample per chip. I need matlab coding for oversampling , so that it could be, 1 chip = 48 sample.

I also need suggestion regarding Despreading of Pilot channel signal to estimate time delay.

Thank you in advanced.

Kabir
--------

clc; clear all; close all;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% IS-95 CDMA
% BitRate = 9.6e3;
% ChipRate = 1.2288e6;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%% Transmitter side %%%%%%%%%%%
data_all_zero = zeros([1,384]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% WALSH CODING %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


channel_num=1; % walsh channel
walsh_matrix=hadamard(64);

for wcol=1:64
    for wrow=1:64
       if walsh_matrix(wcol,wrow)==1;
          walsh_matrix(wcol,wrow)=0;
    else
         walsh_matrix(wcol,wrow)=1;
      end
   end
end

%initialise a variable for holding Walsh coded data chips stream
walshed1=zeros([1,24576]);
for i=1:length(data_all_zero)
      st=((i-1)*64)+1;
    if data_all_zero(i)==0
        walshed1(st:st+63)=walsh_matrix(channel_num,:);
    end
    if data_all_zero(i)==1
        walshed1(st:st+63)= ~(walsh_matrix(channel_num,:));
   end
end
walshed=walshed1;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% MODULATION %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N= length(walshed)/2;

Ishift=zeros([1,14]);
Ishift=[Ishift 1]; % initial value for I pilot PN sequence generator
Qshift=zeros([1,14]);
Qshift=[Qshift 1]; % initial value for Q pilot PN sequence generator

outI=zeros([1,N]); % make two arrays to hold the I and Q bit streams of data
outQ=zeros([1,N]); % each stream hold a total of 12288 bits

%seperate the incoming 24576 walsh code modulated data bit stream
for i=1:2:length(walshed)
     outI(round(i/2))=walshed(i);
     outQ(round(i/2))=walshed(i+1);
end

tranI=zeros([1,N]);
tranQ=zeros([1,N]);
 
sI=zeros([1,N]);
sQ=zeros([1,N]);

%perform modulo-2 addition with the respective PN sequence each stream contains
%12288 chips=24576/2 and set data symbol 0->-1 and 1->1
for i=1:N
          sI(i)=Ishift(15);
          sQ(i)=Qshift(15);
          tranI(i)=mod((outI(i)+Ishift(15)),2);
          tranQ(i)=mod((outQ(i)+Qshift(15)),2);

              if tranI(i)==0
                  tranI(i)=-1;
              end

              if tranQ(i)==0
                  tranQ(i)=-1;
              end

        %The I and Q pilot PN sequence generating polynomials
        %I=x^15+x^13+x^9+x^8+x^7+x^5+1
        %Q=x^15+x^12+x^11+x^10+x^6+x^5+x^4+x^3+1

        %we calculate the Q and I LFSR feedback value
        Ifeed=mod((Ishift(15)+Ishift(13)+Ishift(9)+Ishift(8)+ Ishift(7)+Ishift(5)),2);
        Qfeed=mod((Qshift(15)+Qshift(12)+Qshift(11)+Qshift(10)+Qshift(6)+Qshift(5)+ Qshift(4)+Qshift(3)),2);
        %shifting
        Ishift(2:15)=Ishift(1:14);
        Qshift(2:15)=Qshift(1:14);
        %shifting for the LFSRS
        Ishift(1)=Ifeed;
        Qshift(1)=Qfeed;
end

%%%%%% generate carrier signal
fc=890e6; % Forward Link: carrier freq. 869 to 894 MHz
fs=1.2288e6; % sample rate = chip rate
t=[0:length(tranI)-1]/fs;

%fs=8.*1.2288e6; % sample rate = 8*chip rate
%t=(0:8*length(tranI)-1)/fs;

c_cos=cos(2*pi*fc*t); % carrier cos;
c_sin=sin(2*pi*fc*t); % carrier sin;

tranIc= tranI.*c_cos; % I-channel multiply carrier
tranQc= tranQ.*c_sin; % Q-channel multiply carrier

T_oWave=tranIc+j.*tranQc; % i.e. Transmitted wave = I+jQ;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% AWGN CHANNEL %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 SNR = 30; % snr in dB
 noise = randn(size(T_oWave));
 const = std(T_oWave)/(std(noise).*10^(SNR/20));

%%%%%%%% Receiver side %%%%%%%%%%%

Rx = T_oWave + noise.*const;
I_loc_carrier=c_cos;
Q_loc_carrier=c_sin;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% DEMODULATION %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N = length(Rx);
real_Rx = Rx.*I_loc_carrier;
imag_Rx = Rx.*Q_loc_carrier;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%seperate the I and Q streams
outI2=zeros([1,N]);
outQ2=zeros([1,N]);

for i=1:N
   if real_Rx(i)>=0
       outI2(i)=1;
   end
   if real_Rx(i)<0
       outI2(i)=0;
   end

   if imag_Rx(i)>=0
       outQ2(i)=(1*sqrt(-1));
       outQ2(i)=imag(outQ2(i));
   end
   if imag_Rx(i)<0
       outQ2(i)=(0*sqrt(-1));
       outQ2(i)=imag(outQ2(i));
   end
end

 Rx_I_data = outI2';
 Rx_Q_data = outQ2';
 
 Rx_Isg = [Rx_I_data Rx_I_data];
 Rx_Qsg = [Rx_Q_data Rx_Q_data];
 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%--- PN Spreading sequences generation-----

Gi_ind = [15, 13, 9, 8, 7, 5, 0]';
Gq_ind = [15, 12, 11, 10, 6, 5, 4, 3, 0]';

Gi = zeros(16, 1);
Gi(16-Gi_ind) = ones(size(Gi_ind));
Zi = [zeros(length(Gi)-1, 1); 1]; % Initial State for I-Channel PN generator

Gq = zeros(16, 1);
Gq(16-Gq_ind) = ones(size(Gq_ind));
Zq = [zeros(length(Gq)-1, 1); 1]; % Initial State for Q-Channel PN generator

% Rate = 1.2288 Mcps
[PNi Zi] = PNGen(Gi, Zi, N); % I-channel PN generation
[PNq Zq] = PNGen(Gq, Zq, N); % Q-channel PN generation

 Dspr_PNi = [PNi PNi];
 Dspr_PNq = [PNq PNq];
 
 %%% perform Correlations %%%%%%

 w=N;
 for n=1:w
       Corr1i(n) = Rx_Isg(1:w)*Dspr_PNi(n:w-1+n)';
       Corr2i(n) = Rx_Qsg(1:w)*Dspr_PNi(n:w-1+n)';
       Corr1q(n) = Rx_Isg(1:w)*Dspr_PNq(n:w-1+n)';
       Corr2q(n) = Rx_Qsg(1:w)*Dspr_PNq(n:w-1+n)';
 end
 
 Corr1iq = Corr1i + Corr2q;
 Corr2iq = Corr1q - Corr2i;
 Corr12 = Corr1iq.*Corr1iq + Corr2iq.*Corr2iq;
 
 [peak ph] = max(Corr12);
 chip_delay = length(Corr12)- ph
 plot(Corr12)
--------------------------------------------------------

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
qpsk Md.Humayun Kabir 14 Aug, 2009 14:49:24
time delay Md.Humayun Kabir 14 Aug, 2009 14:49:24
pilot acquisition Md.Humayun Kabir 14 Aug, 2009 14:49:24
cdma Md.Humayun Kabir 14 Aug, 2009 14:49:24
despreading Md.Humayun Kabir 14 Aug, 2009 14:49:24
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com