没有合适的资源?快使用搜索试试~ 我知道了~
(精品word)cdma的MATLAB仿真源程序.doc
需积分: 5 0 下载量 185 浏览量
2022-10-23
23:37:14
上传
评论
收藏 97KB DOC 举报
温馨提示
试读
47页
(精品word)cdma的MATLAB仿真源程序.doc
资源推荐
资源详情
资源评论
(精品 word)cdma 的 MATLAB 仿真源程序
%*********************************************************
****************************
% 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(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
%
(精品 word)cdma 的 MATLAB 仿真源程序
% 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)
%****************************************************************
*******************
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 value +1 or -1
x = rand(1,L);
x(find(x<0.5)) = —1;
x(find(x >=0。5)) = 1;
(精品 word)cdma 的 MATLAB 仿真源程序
%***********************************************************
**************************
% 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(c,y)
tmp = reshape(y, length(c), length(y)/length(c));
tmp = tmp';
%x is a column vector
x = tmp * c;
% convert to row vector
x = x';
%**************************************************************
***********************
% This function does the DS—SS modulation
%
% AUTHOR: Wenbin Luo
% DATE : 04/28/01
%
(精品 word)cdma 的 MATLAB 仿真源程序
% 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)
%******************************************************************
*****************
function y = ds_mod(c,x)
tmp = c*x;
y = tmp(:);
%***********************************************************
% This mfunction generates faded envelope and phase
% corresponding to Rayleigh fading
%
% AUTHOR: Wenbin Luo
% DATE : 04/27/01
%
% FUNCTION SYNOPSIS:
% [env,phi] = fade(L,para)
%
% Parameter Description:
% L : number of samples needed
% variance : variance
%**********************************************************
function [env,phi] = fade(L,variance)
% Error check
if variance 〈= 0
(精品 word)cdma 的 MATLAB 仿真源程序
error(’Positive variance needed')
elseif nargin ~= 2
error('Insufficient input parameters’)
end
% Generate bivariate Gaussian uncorrelated
% random variables
mu = zeros(1,2);
C = variance*eye(2,2);
r = mvnrnd(mu,C,L);
% Convert to polar coordinates and compute
% magnitude and phase
z = r(:,1) + j*r(:,2);
env = abs(z); phi = angle(z);
%**********************************************************
%***********************************************************
% This mfunction generates two channels of faded
% envelope and phase corresponding to
% Rayleigh fading
%
% AUTHOR: Wenbin Luo
% DATE : 04/27/01
%
% FUNCTION SYNOPSIS:
% [env,phi] = fade_diversity(L,para)
%
% Parameter Description:
% L : number of samples needed
剩余46页未读,继续阅读
资源评论
智慧安全方案
- 粉丝: 3670
- 资源: 59万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功