《cdma的MATLAB仿真源程序》由会员分享,可在线阅读,更多相关《cdma的MATLAB仿真源程序(50页珍藏版)》请在人人文库网上搜索。
1、*% This function pertains to the addition of AWGN with mean zero and % parameter variance to an input signal. % AUTHOR: Wenbin Luo% DATE : 04/12/01% SYNOPSIS: y = awgn(x,var)% x - input signal% var - variance% y - y = x + AWGN %*function y = awgn(x,var)w = randn(1,length(x);w = w - mean(w)*ones(size。
2、(w);w = sqrt(var)*(w / std(w); x = x(:); w = w(:); y = x + w; %*% This function does the DS-SS modulation% AUTHOR: Wenbin Luo% DATE : 04/28/01% SYNOPSIS: y = ds_mod(c,x)% c - user code (column vector)% x - input signal (row vector)% y - tmp = c*x, y = tmp(:) (ds-ss modulated signal, column vector)%*。
3、function y = ds_mod(c,x)tmp = c*x;y = tmp(:);%*% This function generates random +1/-1 sequence with independent identically % distributed symbols% AUTHOR: Wenbin Luo% DATE : 04/28/01% SYNOPSIS: x = bingen(L)% L - number of random symbols %*function x = bingen(L)%generate L symbols randomly with valu。
4、e +1 or -1x = rand(1,L);x(find(x=) = 1;%*% This function does the DS-SS modulation% AUTHOR: Wenbin Luo% DATE : 04/28/01% SYNOPSIS: x = ds_demod(c,y)% c - user code (column vector)% y - tmp = c*x, y = tmp(:) (ds-ss modulated signal, column vector)% x - input signal (row vector)%*function x = ds_demod。
5、(c,y)tmp = reshape(y, length(c), length(y)/length(c);tmp = tmp;%x is a column vectorx = tmp * c;% convert to row vectorx = x;%*% T