资源简介
Generation of Walsh code
Generating data for User1
Spreading & IFFT for User1
Append Cyclic Prefix1 for User1
Generating data for User2
Spreading & IFFT for User2
Append Cyclic Prefix1 for User2
Adding data for Transmission of All User
Creating Rayleigh Channel
Addition of AWGN noise
代码片段和文件信息
close all;
clear;clc;
users=2; % Number of Users
%------------------Generation of Walsh code--------------------------------
n =4; %Number of Data Sub-Carriers
walsh=hadamard(n);
code1=walsh(2:); %Taking 2nd row of walsh code for User1
code2=walsh(4:); %Taking 3rd row of walsh code for User2
%------------------Generating data for User1-------------------------------
N=10^4; % Number of Bits for data_user1
data_user1= rand(1N)>0.5; % Generation of data for user1
data_user1bpsk = 2*data_user1-1; % BPSK modulation 0 -> -1; 1 -> 0
%------------------Spreading & IFFT for User1------------------------------
data_user11=data_user1bpsk‘;
spdata1_user1=data_user11*code1; % Spreading
spdata12=(spdata1_user1)‘;
ifftdata_user1=ifft(spdata12); % Taking the IFFT
ifftdata12=ifftdata_user1‘;
%------------------Append Cyclic Prefix1 for User1-------------------------
y1=[ifftdata12(:[(n-2):n]) ifftdata12];
transdata1=y1‘;
tx_user1=transdata1; % Transmitting data for user1
%------------------Generating data for User2-------------------------------
M=10^4; % Number of Bits for data_user2
data_user2= rand(1M)>0.5; % Generation of data for user2
data_user2bpsk = 2*data_user2-1; % BPSK modulation 0 -> -1; 1 -> 0
%-----------------Spreading & IFFT for User2-------------------------------
data_user21=data_user2bpsk‘;
spdata2=data_user21*code2; % Spreading
spdata22=(spdata2)‘;
ifftdata_user2=ifft(spdata22); % Taking the IFFT
ifftdata22=ifftdata_user2‘;
%-----------------Append Cyclic Prefix1 for User2--------------------------
y2=[ifftdata22(:[(n-2):n]) ifftdata22];
transdata2=y2‘;
tx_user2=transdata2; % Transmitting data for user2
%----------------------Adding data for Transmission of All User------------
x=tx_user1+tx_user2;
%----------------------Creating Rayleigh Channel---------------------------
Taps=4; % Number of Taps
p1=0.5/2.3; % Power of Tap1
p2=0.9/2.3; % Power of Tap2
p3=0.7/2.3; % Power of Tap3
p4=0.2/2.3;
gain1=sqrt(p1/2)*[randn(1N) + j*randn(1N)]; % Gain for Tap1
gain2=sqrt(p2/2)*[randn(1N) + j*randn(1N)]; % Gain for Tap2
gain3=sqrt(p3/2)*[randn(1N) + j*randn(1N)]; % Gain for Tap3
gain4=sqrt(p4/2)*[randn(1N) + j*randn(1N)]; % Gain for Tap4
x11=x(:);
x12=reshape(x111length(x11));
i=1:length(x12);
delay1=1;
for i=delay1+1:length(x12) % Producing one sample delay in Tap2 w.r.t. Tap1
x13(i)=x(i-delay1);
end
delay2=2;
for i=delay2+1:length(x12) % Producing two sample delay in Tap2 w.r.t. Tap1
x14(i)=x(
- 上一篇:热电联产CGAM问题建模
- 下一篇:最有潮流计算程序matlab
评论
共有 条评论