⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 walsh_dec.m

📁 The result is an IS-95CDMA forward link software simulation package ,which mimics real-time data com
💻 M
字号:

function dewalshed=Walsh_dec(R_received,channelnum)

%This is the Walsh decoder
%initialise the walsh matrix

de_walsh=hadamard(64);

%in the hadamard matrix. A〃0〃 is represented as a 1, a〃1〃 is represented as a〃-1〃 we need to convert the walsh matrix into 〃0〃s and ¨1〃s form
%0=1  -1=1

for col=1:64

    for row=1:64

      if de_walsh(col,row)==1
          de_walsh(col,row)=0;

       else
         de_walsh(col,row)=1;
      end

    end

end

%initialise temp for holding the matched data chips stream
matched =[];


%the output from IQ demodulator has 24576 chips,and we decode 64 chips at a time


for k=1:64:24576
   temp1=[];
   temp1=R_received(k:k+63);

   %2 buffer for the normal (for symbol 0)and inverted version(for symbol 1) of the row of walsh chips of the Hadamard matrix

  tempp1=de_walsh(channelnum,:);
  tempp2=~(de_walsh(channelnum,:));

   %calculate errors when matching the 64 chips sequence with each of the buffer

  err1 =length(find(tempp1-temp1));
  err2 =length(find(tempp2-temp1));


    if err1<err2
      matched =[matched,0];
    end

    if err2<err1
     matched =[matched,1];
    end

    if err1==err2
      chance=randn;
      if chance<=0
         matched=[matched,0];
      end
      if chance>0
         matched=[matched,1];
      end
    end
end
    

dewalshed=matched;


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -