www.gusucode.com > matlab通信工程仿真源码(张德丰等编著)程序书籍 > matlab_code/matlab通信工程仿真源码(张德丰等编著)/第10章/Demodulator.m

    function [SD] = Demodulator(RxIn, PN, MF, Walsh); 
% 此函数是实现基于RAKE接收机的IS-95前向信链路系统的数据包的解调 
% RxIn为输入信号
% PN为PN码序列(用于解扩) 
% MF为 匹配滤波器参数
% Walsh为用于解调的walsh码 
% SD为RAKE接收机的软判决输出
global R  
N = length(RxIn)/R; L = length(MF); 
L_2 = floor(L/2); rr = conv(flipud(conj(MF)), RxIn); 
rr = rr(L_2+1: end - L_2); 
Rx = sign(real(rr(1:R:end))) + j*sign(imag(rr(1:R:end)));   
Rx = reshape(Rx, 64, N/64); 	
Walsh = ones(N/64, 1)*sign(Walsh'-1/2);
PN = reshape(PN, 64, N/64)'; PN = PN.*Walsh;				 
% 输入速率 = 1.2288 Mpbs, 输出速率 = 19.2 KBps 
SD= PN*Rx;  	 SD= real(diag(SD));