Hệ thống lai ghép CDMA đa sóng mang-đa mã Luận văn ThS. Kỹ thuật điện tử

37 145 0
Hệ thống lai ghép CDMA đa sóng mang-đa mã  Luận văn ThS. Kỹ thuật điện tử

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

TR I H C QU C GIA HÀ N I NG I H C CÔNG NGH HOÀNG V N TU N H TH NG LAI GHÉP CDMA A SÓNG MANG- A MÃ Ngành: Công ngh i n T - Vi n thông Chuyên ngành: K thu t i n t Mã s : 60.52.70 LU N V N TH C S NG IH NG D N KHOA H C: PGS.TS NGUY N VI T KệNH Hà n i 2008 M cl c Danh m c ký hi u ch vi t t t Danh m c hình v b ng L i nói đ u Ph n I: Gi i thi u H th ng CDMA lai ghép 11 1.1 K thu t tr i ph CDMA 11 1.2 H th ng CDMA đa sóng mang 13 1.2.1 Mô t h th ng truy n d n a sóng mang 13 1.2.2 Mô hình h th ng lai ghép CDMA đa sóng mang 17 1.2.3 u nh c m c a h th ng MC CDMA 22 1.2.3.a u m c a MC CDMA 22 1.2.3.b Nh 23 c m c a MC CDMA 1.3 H th ng CDMA đa mư 24 1.3.1 Gi i thi u t ng quan 24 1.3.2 Các lo i mã s d ng h th ng CDMA 24 1.3.2.a Mã Walsh 24 1.3.2.b Mã Gold Kasami 25 1.3.3 Mô hình h th ng CDMA đa mã Ph n II: H th ng lai ghép CDMA đa sóng mang đa mã 27 30 2.1 Mô hình h th ng MTC-MC CDMA 30 2.2 Phân tích h th ng MTC-MC CDMA 33 2.3 Hi u n ng c a h th ng MTC-MC CDMA 38 2.4 S thích nghi t c đ c a h th ng MTC-MC CDMA kênh fading đa đ ng 42 2.4.1 Mô hình kênh fading đa đ 2.4.1.a Kênh fading đa đ 2.4.1.b a đ ng 42 ng n hình ng tán x đa đ 2.4.1.c Mô hình hóa kênh fading đa đ 42 ng r i r c 47 ng 47 2.4.2 S thích nghi t c đ 52 2.4.3 Mô ph ng 55 K t lu n 62 Tài li u tham kh o 63 Ph l c: Mư ngu n m t vài ch ng trình mô ph ng (Matlab) 65 Danh m c ký hi u ch vi t t t 3G Third Generation Thông tin di đ ng th h 4G Fouth Generation Thông tin di đ ng th h AWGN Additive White Gaussian Noise T p âm Gauss tr ng c ng tính BCK Biothogonal Code Keying Khóa mư l BER Bit Erorr Rate T l l i bit BS Base Station Tr m g c CDM Code Division Multiplexing Ghép kênh phân chia theo mã CDMA Code Division Multiple Access a truy nh p phân chia theo mư Cdma2000 Code Division Multiple Access 2000 (American 3G Standard) a truy nh p phân chia theo mư theo chu n 3G c a M CP Cyclic Prefix Ti n t vòng DFT Discrete Fourier Transform Bi n đ i Fourier r i r c DS Direct Sequence Chu i tr c ti p DS-CDMA Direct Sequence CDMA CDMA chu i tr c ti p EGC Equal Gain Combining T h p đ l i cân b ng FDM Frequency Division Multiplexing Ghép kênh phân chia t n s FDMA Frequency Division Multiple Access FFT Fast Fourier Transform Bi n đ i Fourier nhanh FH Frequency Hopping Nh y t n IC Interference Cancellation Tri t nhi u ICI Inter-Carrier Interference Nhi u xuyên sóng mang IDFT Inverse Discrete Fourier Trasform Bi n đ i ng c Fourier r i r c IFFT Inverse Fast Fourier Transform Bi n đ i ng c Fourier nhanh IID Independent Identically Distributed Phân b đ c l p đ ng nh t IS-95 Interim Standard-95 Chu n t m th i n m 95 c a CDMA ISI Inter-Symbol Interference Nhi u xuyên ký hi u LTV Linear Time - Varying Tuy n tính thay đ i theo th i gian LTI Linear Time - Invariant Tuy n tính b t bi n theo th i gian MAI Multiple Access Interference Nhi u đa truy nh p ng tr c giao a truy nh p phân chia t n s MBCK Multi-Code Biorthogonal Keying Khóa mư l MC-CDMA Multicarrier CDMA CDMA đa sóng mang MC-DS-CDMA Multicarrier-DS-CDMA DS-CDMA đa sóng mang MCM Multi-Carrier Modulation i u ch đa sóng mang MC-SS Multi-Carrier Spread Spectrum Tr i ph đa sóng mang MF Matched Filter B l c hòa h p M-FSK M-ary Frequency Shift Keying Khóa d ch t n M-m c MIMO Multiple Input and Multiple Output Thi t b nhi u đ u vào – ML Maximum Likelihood Lu t h p lý c c đ i MLSE Maximum Likelihood Sequence Estimation MLSSE Maximum Likelihood Symbol-bySymbol Estimation c l ng t ng ký hi u g n gi ng nh t MMSE Minimum Mean Square Error L i bình ph ti u MRC Maximum Ratio Combining K th pt s c cđ i MS Mobile Station Tr m di đ ng MTC CDMA Multi-code CDMA CDMA đa mư MTC-MC CDMA Multi-code Multicarrier CDMA CDMA đa sóng mang a mư MUI Multiple User Interference Nhi u đa ng Multicarrier-Code Division Multicarrier-CDMA Multiplexing cl ng tr c giao đa mư ng chu i g n gi ng nh t ng trung bình c c i dùng a truy nh p phân chia theo mư đa sóng mang OFDM Orthogonal Frequency Division Multiplexing Ghép kênh phân chia theo t n s tr c giao ORC Orthogonal Restoring Combing K t h p khôi ph c tr c giao P/S Parallel-to-Serial Song song sang n i ti p PG Processing Gain PIC Parallel Interference Cancellation Tri t nhi u song song PN Pseudo Noise Chu i gi ng u nhiên QPSK Quaternary Phase Shift Keying Khóa d ch pha c u ph S/P Serial-to-Parallel N i ti p sang song song l i x lý ng SINR Signal to Interference Noise Ratio T s công su t trung bình c a tín hi u t p âm c ng can nhi u SNR Signal-to-Noise (power) Ratio T s (công su t) tín hi u t p âm Danh m c hình v b ng Hình 1.1 Nguyên lý tr i ph theo DS-CDMA 11 Hình 1.2 a) Máy phát; b) Ph công su t phát; c) Máy thu RAKE 13 Hình 1.3 H th ng truy n d n đa sóng mang áp d ng OFDM 15 Hình 1.4 Mô hình h th ng MC CDMA 18 Hình 1.5 Nguyên lý tr i ph c a h th ng MC CDMA 18 Hình 1.6 S đ kh i h th ng Multicarrier-CDMA 20 Hình 1.7 S đ kh i h th ng MC CDMA v i N ≠ PG 21 Hình 1.8 B t o chu i Gold 26 Hình 1.9 S đ h th ng Multi-Code CDMA tr c giao thông th ng Hình 2.1 S đ c u trúc Máy phát (a) máy thu (b) c a h h ng TCMC CDMA Hình 2.2 K t qu mô ph ng c a BER theo SNR c a h MC-CDMA, MTC CDMA, MTC-MC CDMA v i M thay đ i T t c h th ng chi m t ng b ng t n nh Hình 2.3 So sánh gi a phân tích lý thuy t v i k t qu mô ph ng (L=16) c a BER theo SNR, tr ng h p kênh sóng mang đ c l p v i Hình 2.4: th BER theo s ng i s d ng h th ng MCCDMA h th ng MTC-MC CDMA Hình 2.5: SINR thu đ c Theo SNR v i K, M thay đ i Có th th y r ng giá tr M không đ i v i SINR phía thu Hinh 2.6 Minh h a kênh fading đa đ ng Hình 2.7 Minh h a đáp ng xung kim c a kênh biên d ng tr đa đ ng Hình 2.8 l i kênh fading Rayleigh 27 Hình 2.9 Biên d ng tr công su t c a mô hình tia thành ph 52 Hình 2.10 S u ki n t c đ thích nghi kênh fading đa đ ng Hình 2.11 th BER theo SNR c a h th ng MTC CDMA s d ng mư Walsh, Gold, Kasami kênh AWGN (S ng i dùng= 10 16) Hình 2.12 th BER theo S ng i s d ng h th ng MTC CDMA s d ng mư Walsh, Gold, Kasami kênh AWGN (SNR=10dB, M=16) Hình 2.13 th BER theo SNR h th ng MTC CDMA s d ng mư Walsh, Gold, Kasami kênh fading đa đ ng (s ng i dùng=10 16) Hình 2.14 th BER theo s ng i dùng h th ng MTC CDMA kênh AWGN (SNR=10dB) kênh fading (SNR=40dB), (M=16) 55 31 38 39 40 41 43 46 51 57 57 58 59 Hình 2.15 th BER theo s ng i dùng h th ng MTC CDMA v i có thích nghi t c đ kênh fading đa đ ng (SNR = 40dB, M=16 cho MTC CDMA không thích nghi t c đ ) Hình 2.16 th BER theo SNR cho MTC CDMA, MTC-MC CDMA thích nghi t c đ , MTC-MC CDMA có thích nghi t c đ kênh fading đa đ ng (s ng i s d ng =10, sóng mang con=16 cho MTC-MC, M=16 cho MTC CDMA MTC-MC CDMA không thích nghi t c đ ) Hình 2.17 Giá tr trung bình M theo s ng i dùng h th ng MTC-MC CDMA có thích nghi t c đ kênh fading đa đ ng (SNR=40dB) B ng 1.1 Các giá tr đ u si4 dùng ma tr n Hadamard 4×4 59 60 61 29 B ng 2.1 Biên d ng tr công su t c a d ng t bào đô th đô th x u v i 6-tia 51 B ng 2.2 Các thông s mô ph ng 56 L i nói đ u H th ng không dây t ng lai nh m ng t bào th h th (4G) đòi h i cung c p m t cách linh ho t cho thuê bao v i d ch v đa d ng nh tho i, d li u, nh truy n hình B i d ch v có t c đ d li u khác r t nhi u, h th ng th h t ng lai s ph i thích nghi v i tính đa d ng r t l n c a t c đ d li u a truy c p phân chia mư (CDMA) đư đ c ch ng minh r t thành công cho h th ng tho i t bào l n, nh ng có m t vài thái đ hoài nghi v vi c li u CDMA s thích h p t t v i truy n khác tho i i u đư thúc đ y nghiên c u h th ng CDMA đa mư cho phép t c đ d li u thay đ i b ng cách phân ph i đa mư, thay đ i dung l ng ng i s d ng khác Trong lúc CDMA đa sóng mang (MC-CDMA) đư n i lên nh nh s thay th m nh m CDMA chu i tr c ti p (DS-CDMA) truy n th ng thông tin vô n di đ ng, cho th y hi u qu t t h n CDMA đ n sóng mang kênh fading đa đ ng Trong lu n v n nêu phân tích k thu t u ch , đa truy c p m i s k t h p gi a h th ng CDMA đa sóng mang v i h th ng đa mư đ t n d ng l i th t t nh t c a m i h th ng tr c So v i k thu t truy n đa t c h th ng CDMA đ n sóng mang kênh AWGN đư đ c đ c p tr c đó, k thu t đa mư m i làm cân đ i gi a s thuê bao có th v i t c đ d li u m i thuê bao, nói cách khác s ng i s d ng đ ng th i t c đ cao h th ng CDMA đa mư s h n s ng i s d ng t c đ d li u b ng h th ng CDMA truy n th ng tr c Thay đ i s đ đa mư, s giúp thay đ i t c đ d li u b ng cách thay đ i t p h p chu i mư đ dùng Ng c ch đ nh cho m i ng i i dùng truy n d li u c a b ng cách ch n m t chu i t t h p mư c a h đ truy n kênh Nh v y, hi u n ng h CDMA đa mư ch coi nh kênh AWGN n đư có hai lo i nghiên c u truy n d n đa t c đ d a đa sóng mang–tr i ph chu i tr c ti p (MCDS CDMA) Th nh t nghiên c u truy n đa t c cho h th ng CDMA chu i tr c ti p đa sóng mang d a nguyên lý c b n g m truy c p đa mư th hai truy c p mư h s tr i bi n đ i Trong CDMA đa mư, dòng d li u c a ng i s d ng t c đ M ban đ u đ c ghép kênh vào M dòng liên ti p khác v i m t t c đ d li u c b n, m i dòng liên t c coi nh m t ng i s d ng riêng bi t Sau m i dòng liên ti p M đ thành P dòng nh song song đ c bi n đ i c tr i ph b i mư tr i ph gi ng m t h s tr i ph H th ng CDMA chu i tr c ti p đa sóng mang có M l n nhi u/ng đ c coi nh m t ng i s d ng, b i m i dòng M dòng d li u i dùng đ c l p Do đó, h th ng ch u nhi u nhi u h n t ng t c đ d li u, v i s ng i dùng c đ nh Trong h th ng CDMA đa sóng mang đa t c, sóng mang đ c phân chia vào M nhóm theo t c đ d li u yêu c u Do đó, s sóng mang c đ nh, h s tr i mi n t n s c a d li u b gi m t ng t c đ d li u H th ng CDMA đa mư đ t v n đ tr i r ng can nhi u b ng h đa mư b i ch s d ng m t chu i mư đ thay cho vi c tr i t ng dòng M dòng d li u đ c ghép kênh, làm cho nhi u không t ng n tính v i t c đ d li u Dù th h th ng CDMA đa mư c ng không th đ t đ c đ l i phân t p t n s c a u ch đa sóng mang H th ng CDMA đa sóng mang đa mư (MTC-MC CDMA ) s k t h p hoàn h o hai h th ng CDMA đa sóng mang h th ng CDMA đa mư, có đ c u m c a c hai h th ng nh : (i) t c đ d li u thay đ i mà không m r ng nhi u (ii) kh n ng ch ng kênh fading đa đ ng H n n a, h th ng có c h s tr i mi n t n s tr i mi n th i gian đ t n d ng hài hòa c phân t p trung bình hóa can nhi u c a đ c tính c a h th ng u ch đa sóng mang CDMA Hi u n ng c a h th ng MTC-MC CDMA đ c suy theo bi u th c gi i tích c i ti n h th ng t h th ng MC-CDMA, c ng thông qua nh ng phân tích đ c mô ph ng kênh fading ch n l c t n s N i dung c a nh ng ph n ti p theo c a lu n v n g m: Ph n I : Gi i thi u v h th ng CDMA lai ghép Ph nII : H th ng lai ghép CDMA đa sóng mang đa mư Ph l c: Mã ngu n m t vài ch ng trình ch y mô ph ng (Matlab)  MTC CDMA simulator in Multipath fading channel (mtcdma.m) function F = mtcdma(code,K,M,SNR,iteration) % Multi-code CDMA Simulator in Multipath fading channel Ver 2.0 by CDMA team % % Description : Simulator for Multi-cdoe CDMA Systems % (Using Multipath Rayleigh Fading channel % with "Typical macrocellular urban 6-ray power delay profiles" % from "Principles of MOBILE COMMUNICATION" by Gordon L Stuber) % % ***USAGE : % mtcdma(code,K,M,SNR,iteration),(e.g mtcdma(1,5,8,10,10000)) % X=mtcdma(code,K,M,SNR,iteration) returns a vector which is [Bit error rate,Symbol error rate] % % Parameter % code : = Walsh, = Gold, = Kasami, = M-sequence % K : No of Users % M : No of sequence which we use in the G(n) sequence set = M-ary % SNR : SNR (dB) % iteration : iteration number = symbol number % % Using m-files : bit_gen.m, m_seq_gen.m, gold.m, kasami.m, % BasicSeqK.m,BasicSeq.m, Gaussian.m, % "NEED CDMA Communication Toolbox" % FYI #1 : "00000" all zero bit is mapped to 1st symbol That means if the % binary value of information bits is n, then the symbol is (n+1)th % sequence % FYI #2 : In every vector [1, ,N], is the first bit and N is the % last bit in time domain and frequency domain % Generate sequence set G_set, G(user,time) G_set=[]; switch code case {1} G_set = hadamard(256); % Length of G = 256 case {2} G_set_temp = gold(1); % Length of G = 255, NOT 256 G_set = [G_set_temp ones(length(G_set_temp(:,1)),1)]; % Add "1" for the last bit(256th) to the code whose length is 255 case {3} G_set_temp = kasami(1); % Length of G = 255, NOT 256 G_set = [G_set_temp ones(length(G_set_temp(:,1)),1)]; % Add "1" for the last bit(256th) to the code whose length is 255 case {4} p = [1 0 1 1]; %(1) G_one = m_seq_gen(g,1); for I=1:255 G_set_temp(I,:) = circshift(G_one,[0,I-1]); end G_set(I,:) = [G_set_temp(I,:) 1]; % Add "1" for the last bit(256th) to the code whose length is 255 end % Generate user specific sequence U, U(user,time) p2 = [1 0 1 1]; %(2) g2 = m_seq_gen(p2,1); for I=1:K U_temp(I,:) = circshift(g2,[0,I-1]); U(I,:) = [U_temp(I,:) 1]; end E_stot = zeros(1,K); E_btot = 0; fd = 50; fs = 1.228*10^2; for i=1:4*K fad(i,:) = ray2(fd,fs,iteration/40,1); fad(i,:)= fad(i,:) / mean(fad(i,:)); end Resid = zeros(K,5); fad_a = [0.8070 0.095 0.061 0.037]; %fad_tau = [0 1.6 2.4 4.8]; % N_leng : Length of the sequence G(n) -> We fixed this length = 255 or 256 N_leng = 256; Z = zeros(K,N_leng); for itr = 1:iteration %*********************************** iteration = symbol number ********************************** % Generate the Tx bits & Make M-ary Symbol No_bit=log2(M); % Calculation the sigma for AWGN EbNo_temp = SNR/10.; N_temp = (N_leng)/(10^EbNo_temp); %%%%%%%%% for the same Es/No sigma = sqrt(N_temp/2); %dec=zeros(1,No_bit); symbol = bit_gen(1,No_bit,K); % symbol(1,time,user) symbol_temp = zeros(No_bit,K); symbol_temp(:,:) = symbol(1,:,:); symbol_index = bi2de(sign(symbol_temp+1)')+1; G = G_set(symbol_index,:); % Transmitter % Spread in Frequency domain, X:Spreaded Signal in Freq domain, X = G.*U; % Fading channel, output >SF() if itr == iteration fad_ind = floor(itr/40); else fad_ind = floor(itr/40) + 1; end Gain(:,1) = fad(:,fad_ind); %Gain(User*4,1), that means Gain(1:4,:) is for user and Gain(5:8,:) is for user SF = zeros(K,N_leng); i=1:K; SF(:,:) = X(i,:).*repmat(Gain(4*(i-1)+1,1),1,N_leng).*fad_a(1)+[Z(:,1:2) X(i,1:N_leng-2)].*repmat(Gain(4*(i-1)+2,1),1,N_leng).*fad_a(2)+[Z(:,1:3) X(i,1:N_leng-3)].*repmat(Gain(4*(i-1)+3,1),1,N_leng).*fad_a(3)+[Z(:,1:5) X(i,1:N_leng-5)].*repmat(Gain(4*(i-1)+4,1),1,N_leng).*fad_a(4); SF(:,:) = SF(:,:) + [Resid(i,4:5) Z(:,1:N_leng-2)].*fad_a(2).*repmat(Gain(4*(i1)+2,1),1,N_leng)+[Resid(i,3:5) Z(:,1:N_leng-3)].*fad_a(3).*repmat(Gain(4*(i1)+3,1),1,N_leng)+[Resid(i,:) Z(:,1:N_leng-5)].*fad_a(4).*repmat(Gain(4*(i1)+4,1),1,N_leng); Resid(:,:) = X(:,(N_leng-4):N_leng); SF_SUM = sum(SF,1); % AWGN, R(chip index) R = SF_SUM + sigma*randn(1,N_leng); % Receiver, R_desp(K,) R_desp = repmat(R,K,1).*U; % Detection using Matched filter for G(n), out_mat(user,output value of matched filter for % each G(n) sequence) out_mat = R_desp*G_set'; % Decode : each index = user No , each elements = Decimal value of maximum output sequence of % matched value [maximum,Decode] = max((out_mat(:,1:M))'); result = Decode - symbol_index'; % Calculate the symbol error E_symbol = sign(abs(result)); E_stot = E_stot + E_symbol; % Calculate the bit error Decode_t = (Decode - 1)'; E_bit_temp = sign(de2bi(Decode_t,No_bit)-0.5) - symbol_temp'; E_bit = sign(abs(E_bit_temp)); E_btot = E_btot + sum(sum(E_bit,1),2); end E_avg = sum(E_stot,2); SER = E_avg/K/iteration; BER = E_btot/K/iteration/No_bit; F = [BER, SER];  MTC-MC CDMA simulator in Multipath fading channel (mccdma.m) function F=mccdma(code,K,M,Sub,SNR,iteration) % Multi-code Multi-Carrier CDMA Simulator in Multipath fading channel % % Description % Parameter % K : No of Users % M : No of sequence which we use in the G(n) sequence set = M-ary % N : Length of the sequence G(n) -> We fixed this length = 255 or 256 % Sub : Number of Subcarrier frequency (Sub SHOULD BE or 16) % % Using m-files : bit_gen.m, m_seq_gen.m % % ***USAGE : mccdma(code,K,M,Sub,SNR,iteration), (e.g mccdma(1,5,32,16,10,10000)) % X=mccdma(code,K,M,Sub,SNR,iteration) returns a vector which is [Bit error rate, Symbol % error rate] % % FYI #1 : "00000" all zero bit is mapped to 1st symbol That means if the % binary value of information bits is n, then the symbol is (n+1)th % sequence % FYI #2 : In every vector [1, ,N], is the first bit and N is the % last bit in time domain and frequency domain % Define the value for parameters N = 256; % Generate sequence set G_set, G(user,time) G_set=[]; switch code case {1} G_set = hadamard(256); % Length of G = 256 case {2} G_set_temp = gold(1); % Length of G = 255, NOT 256 G_set = [G_set_temp ones(length(G_set_temp(:,1)),1)]; % Add "1" for the last bit(256th) to the code whose length is 255 case {3} G_set_temp = kasami(1); % Length of G = 255, NOT 256 G_set = [G_set_temp ones(length(G_set_temp(:,1)),1)]; % Add "1" for the last bit(256th) to the code whose length is 255 case {4} p = [1 0 1 1]; %(1) G_one = m_seq_gen(g,1); for I=1:255 G_set_temp(I,:) = circshift(G_one,[0,I-1]); end G_set(I,:) = [G_set_temp(I,:) 1]; % Add "1" for the last bit(256th) to the code whose length is 255 end % Generate user specific sequence U, U(user,time) switch Sub case {8} p2 = [1 1]; otherwise p2 = [1 0 1]; Sub = 16; end g2 = m_seq_gen(p2,1); for I=1:K U_temp(I,:) = circshift(g2,[0,I-1]); U(I,:) = [U_temp(I,:) 1]; end %U = sign(rand(K,Sub)-.5); U_t=[]; for i=1:K U_t=cat(1,U_t,repmat(U(i,:),N,1)); end E_stot = zeros(1,K); E_btot = 0; fd = 50; fs = 1.228*10^2; for i=1:4*K fad(i,:) = ray2(fd,fs,iteration/40,1); fad(i,:)= fad(i,:) / mean(fad(i,:)); end Resid = zeros(K,80); fad_a = [0.8070 0.095 0.061 0.037]; N = 256; Z = zeros(K,N*Sub); symbol_T = N*Sub; E_btot = 0; for itr = 1:iteration %*********************************** iteration = symbol number ********************************** % Generate the Tx bits & Make M-ary Symbol No_bit=log2(M); % Calculation the sigma for AWGN EbNo_temp = SNR/10.; N_temp = (N*Sub)/(10^EbNo_temp); %%%%%%%%% sigma = sqrt(N_temp/2); symbol = bit_gen(1,No_bit,K); % symbol(1,time,user) symbol_temp = zeros(No_bit,K); symbol_temp(:,:) = symbol(1,:,:); symbol_index = bi2de(sign(symbol_temp+1)')+1; % Select G(n) for each user depending on the information bit(M-ary symbol), % G(user,time) G = G_set(symbol_index,:); if itr == iteration fad_ind = floor(itr/40); else fad_ind = floor(itr/40) + 1; end Gain(:,1) = fad(:,fad_ind); %Gain(User*4,1), that means Gain(1:4,:) is for user and Gain(5:8,:) is for user % Transmitter % Spread in Frequency domain, X:Spreaded Signal in Freq domain, X = repmat(reshape(G',prod(size(G)),1),1,Sub).*U_t; % Do IFFT operation across the rows (dimension = 2) to code into time, S = sqrt(Sub).*ifft(X,Sub,2); S_t = reshape(S',symbol_T,K)'; % Fading channel, output >SF() % ************ We should put the fading channel part at here ******** SF = zeros(K,symbol_T); i=1:K; SF(:,:) = S_t(i,:).*repmat(Gain(4*(i-1)+1,1),1,symbol_T).*fad_a(1)+[Z(:,1:2) S_t(i,1:symbol_T-2)].*repmat(Gain(4*(i-1)+2,1),1,symbol_T).*fad_a(2)+[Z(:,1:3) S_t(i,1:symbol_T-3)].*repmat(Gain(4*(i-1)+3,1),1,symbol_T).*fad_a(3)+[Z(:,1:5) S_t(i,1:symbol_T-5)].*repmat(Gain(4*(i-1)+4,1),1,symbol_T).*fad_a(4); SF(:,:) = SF(:,:) + [Resid(i,64:80) Z(:,1:symbol_T-17)].*fad_a(2).*repmat(Gain(4*(i1)+2,1),1,symbol_T)+[Resid(i,48:80) Z(:,1:symbol_T33)].*fad_a(3).*repmat(Gain(4*(i-1)+3,1),1,symbol_T)+[Resid(i,:) Z(:,1:symbol_T80)].*fad_a(4).*repmat(Gain(4*(i-1)+4,1),1,symbol_T); Resid(:,:) = S_t(:,(symbol_T-79):symbol_T); SF_SUM = sum(SF,1); % AWGN, R(1,N*Sub) R_t = SF_SUM + sigma*randn(1,symbol_T) + j*sigma*randn(1,symbol_T); R = reshape(R_t',Sub,N)'; % Receiver, R(sequence time index, sub-carrier index) R_fft = 1/sqrt(Sub)*fft(R,Sub,2); % Despread, R_desp(user,sequence time index) for i=1:K R_desp_temp(i,:) = (R_fft*U(i,:)'/Sub)'; end R_desp = real(R_desp_temp); out_mat = R_desp*G_set(1:M,:)'; [maximum,Decode] = max(out_mat'); %Decoded_bits = G_set(Decode,:); result = Decode - symbol_index'; % Calculate the symbol error E_symbol = sign(abs(result)); E_stot = E_stot + E_symbol; % Calculate the bit error Decode_t = (Decode - 1)'; E_bit_temp = sign(de2bi(Decode_t,No_bit)-0.5) - symbol_temp'; E_bit = sign(abs(E_bit_temp)); E_btot = E_btot + sum(sum(E_bit,1),2); end E_avg = sum(E_stot,2); SER = E_avg/K/iteration; BER = E_btot/K/iteration/No_bit; F = [BER, SER];  Adaptive function for MTC-MC CDMA system (AdapRateMC.m) function M = AdaptRateMC(R, K, sigma2, SG, MaxM, Sub) % Rate Calculation for Multicode Multicarrier CDMA Simulator v 1.5 by CDMA team % % usage: [M] = AdaptRate(r, sigma, SG) % R : Channel Gain of each user, [R] = r(1 K*4) % K : No of Users % sigma2 : AWGN power = No/2 % SG : Spreading Gain % MaxM : Maximum allowable Rate M % % [M] : Tx Rate of Each User K MinM = 2; i = 0:K-1; r(i+1) = (0.8070*R(4*i+1) + 0.095*R(4*i+2) + 0.061*R(4*i+3) + 0.037*R(4*i+4)); % averaging each user's channel gain rs = r*r'; % total recieved power ri = r.*r; % signal power gamma = ri./(rs - ri + sigma2)*SG*Sub; Pb = 10^-3; K = * log(Pb/0.1); M = 2.^(-1*floor(gamma./K/3)); M = min(max(M,MinM), MaxM);  MTC-MC CDMA simulator with adaptation in Multipath fading channel (mcAdap.m) function F=mcAdap(code,K,MaxM,Sub,SNR,iteration) % Multi-code Multi-Carrier CDMA Simulator with Adaptive algorithm in % Multifath fading channel % Description % Parameter % K : No of Users % M : No of sequence which we use in the G(n) sequence set = M-ary % N : Length of the sequence G(n) -> We fixed this length = 255 or 256 % Sub : Number of Subcarrier frequency (Sub SHOULD BE or 16) % Using m-files : bit_gen.m, m_seq_gen.m % % ***USAGE : mcAdap(c,K,MaxM,Sub,SNR,iteration), (e.g mcAdap(1,5,32,16,10,10000)) % X=mcAdap(c,K,MaxM,Sub,SNR,iteration) returns a vector which is [Bit error rate, Symbol error rate] % % FYI #1 : "00000" all zero bit is mapped to 1st symbol That means if the % binary value of information bits is n, then the symbol is (n+1)th % sequence % FYI #2 : In every vector [1, ,N], is the first bit and N is the % last bit in time domain and frequency domain % Define the value for parameters N = 256; % Generate sequence set G_set, G(user,time) G_set=[]; switch code case {1} G_set = hadamard(256); % Length of G = 256 case {2} G_set_temp = gold(1); % Length of G = 255, NOT 256 G_set = [G_set_temp ones(length(G_set_temp(:,1)),1)]; % Add "1" for the last bit(256th) to the code whose length is 255 case {3} G_set_temp = kasami(1); % Length of G = 255, NOT 256 G_set = [G_set_temp ones(length(G_set_temp(:,1)),1)]; % Add "1" for the last bit(256th) to the code whose length is 255 case {4} p = [1 0 1 1]; %(1) G_one = m_seq_gen(g,1); for I=1:255 G_set_temp(I,:) = circshift(G_one,[0,I-1]); end G_set(I,:) = [G_set_temp(I,:) 1]; % Add "1" for the last bit(256th) to the code whose length is 255 end % Generate user specific sequence U, U(user,time) switch Sub case {8} p2 = [1 1]; otherwise p2 = [1 0 1]; Sub = 16; end g2 = m_seq_gen(p2,1); for I=1:K U_temp(I,:) = circshift(g2,[0,I-1]); U(I,:) = [U_temp(I,:) 1]; end U_t=[]; for i=1:K U_t=cat(1,U_t,repmat(U(i,:),N,1)); end E_stot = zeros(1,K); E_btot = 0; fd = 50; fs = 1.228*10^2; for i=1:4*K fad(i,:) = ray2(fd,fs,iteration/40,1); fad(i,:)= fad(i,:) / mean(fad(i,:)); end Resid = zeros(K,80); fad_a = [0.8070 0.095 0.061 0.037]; N = 256; Z = zeros(K,N*Sub); symbol_T = N*Sub; M = 2*ones(1,K); E_btot = zeros(1,K); No_bit_tot = zeros(1,K); kjw = zeros(iteration,K); kty = zeros(iteration,K); for itr = 1:iteration %*********************************** iteration = symbol number ********************************** % Generate the Tx bits & Make M-ary Symbol No_bit=log2(M); % Calculation the sigma for AWGN EbNo_temp = SNR/10.; N_temp = (N*Sub)/(10^EbNo_temp); %%%%%%%%% sigma = sqrt(N_temp/2); if itr == iteration fad_ind = floor(itr/40); else fad_ind = floor(itr/40) + 1; end Gain(:,1) = fad(:,fad_ind); %Gain(User*4,1), that means Gain(1:4,:) is for user and Gain(5:8,:) is for user for i=1:K symbol = bit_gen(1,No_bit(i),1); % symbol(1,time,user) symbol_index(i) = bi2de(sign(symbol+1))+1; G(i,:) = G_set(symbol_index(i),:); end % Transmitter % Spread in Frequency domain, X:Spreaded Signal in Freq domain, X = repmat(reshape(G',prod(size(G)),1),1,Sub).*U_t; % Do IFFT operation across the rows (dimension = 2) to code into time, S = sqrt(Sub).*ifft(X,Sub,2); S_t = reshape(S',symbol_T,K)'; SF = zeros(K,symbol_T); i=1:K; SF(:,:) = S_t(i,:).*repmat(Gain(4*(i-1)+1,1),1,symbol_T).*fad_a(1)+[Z(:,1:2) S_t(i,1:symbol_T-2)].*repmat(Gain(4*(i-1)+2,1),1,symbol_T).*fad_a(2)+[Z(:,1:3) S_t(i,1:symbol_T-3)].*repmat(Gain(4*(i-1)+3,1),1,symbol_T).*fad_a(3)+[Z(:,1:5) S_t(i,1:symbol_T-5)].*repmat(Gain(4*(i-1)+4,1),1,symbol_T).*fad_a(4); SF(:,:) = SF(:,:) + [Resid(i,64:80) Z(:,1:symbol_T-17)].*fad_a(2).*repmat(Gain(4*(i1)+2,1),1,symbol_T)+[Resid(i,48:80) Z(:,1:symbol_T33)].*fad_a(3).*repmat(Gain(4*(i-1)+3,1),1,symbol_T)+[Resid(i,:) Z(:,1:symbol_T80)].*fad_a(4).*repmat(Gain(4*(i-1)+4,1),1,symbol_T); Resid(:,:) = S_t(:,(symbol_T-79):symbol_T); SF_SUM = sum(SF,1); % AWGN, R(1,N*Sub) R_t = SF_SUM + sigma*randn(1,symbol_T) + j*sigma*randn(1,symbol_T); R = reshape(R_t',Sub,N)'; % Receiver, R(sequence time index, sub-carrier index) R_fft = 1/sqrt(Sub)*fft(R,Sub,2); % Despread, R_desp(user,sequence time index) for i=1:K R_desp_temp(i,:) = (R_fft*U(i,:)'/Sub)'; end R_desp = real(R_desp_temp); % Detection using Matched filter for G(n), out_mat(user,output value of matched filter for % each G(n) sequence) % Decode : each index = user No , each elements = Decimal value of maximum output sequence of % matched value for i=1:K out_mat = R_desp(i,:)*G_set(1:M(i),:)'; [maximum,Deco] = max(out_mat); Decode(i) = Deco; end %Decoded_bits = G_set(Decode,:); result = Decode - symbol_index; % Calculate the symbol error E_symbol = sign(abs(result)); E_stot = E_stot + E_symbol; % Calculate the bit error for i=1:K Decode_t = (Decode(i) - 1)'; E_bit_temp = sign(de2bi(Decode_t,No_bit(i))-0.5) - sign(de2bi((symbol_index(i)1)',No_bit(i))-0.5);%symbol_temp'; E_bit = sign(abs(E_bit_temp)); E_btot(i) = E_btot(i) + sum(E_bit); No_bit_tot(i) = No_bit_tot(i) + No_bit(i); end %%% Calculate Tx Rate M here M = AdaptRateMC(mean(Gain,2), K, N_temp/2, N, MaxM, Sub); kty(itr,:) = M; i=0:K-1; kjw(itr,i+1) = (0.8070*mean(Gain(4*i+1),2) + 0.095*mean(Gain(4*i+2),2) + 0.061*mean(Gain(4*i+3),2) + 0.037*mean(Gain(4*i+4),2))'; end SER = sum(E_stot,2)/K/iteration; BER = sum(E_btot)/sum(No_bit_tot); BER_user = E_btot./No_bit_tot; Mean_M = mean(mean(kty)); F = [BER, Mean_M, SER, BER_user]  H2_11.m clc, figure, i=6:15; inter=1000; % F = mtcdma(code,K,M,SNR,iteration) % Parameter % code : = Walsh, = Gold, = Kasami, = M-sequence % K : No of Users % M : No of sequence which we use in the G(n) sequence set = M-ary % SNR : SNR (dB) % iteration : iteration number = symbol number(=10000) disp('- Tinh BER cua ma Walsh:'), f_ber1=zeros(1,length(i)); for k=1:10 f=mtawgn(1,10,16,i(k),inter); f_ber1(k)=f(1) end semilogy(i,f_ber1,'b-o') hold on, grid on % disp('- Tinh BER cua ma Gold:'), f_ber2=zeros(1,length(i)); for k=1:10 f=mtawgn(2,10,16,i(k),inter); f_ber2(k)=f(1) end semilogy(i,f_ber2,'g-s') hold on, % disp('- Tinh BER cua ma Kasami:'), f_ber3=zeros(1,length(i)); for k=1:10 f=mtawgn(3,10,16,i(k),inter); f_ber3(k)=f(1) end semilogy(i,f_ber3,'r-*') semilogy([8],[.12],'w-'), semilogy([9],[.123],'w-') % dung de tao hai dong chu thich xlabel('SNR (dB)'),ylabel('BER') axis([6 15 001 1]) legend('Walsh code','Gold code','Kasami code','No.of User=10','AWGN')  h2_12.m clc, figure, i=[1 10 15 20 25 30 40 50]; inter=1000; % F = mtcdma(code,K,M,SNR,iteration) % Parameter % code : = Walsh, = Gold, = Kasami, = M-sequence % K : No of Users % M : No of sequence which we use in the G(n) sequence set = M-ary % SNR : SNR (dB) % iteration : iteration number = symbol number(=10000) disp('- Tinh BER cua ma Walsh:'), f_ber1=zeros(1,length(i)); for k=1:11 f=mtawgn(1,i(k),16,10,inter); f_ber1(k)=f(1) end semilogy(i,f_ber1,'b-o') hold on, grid on % disp('- Tinh BER cua ma Gold:'), f_ber2=zeros(1,length(i)); for k=1:11 f=mtawgn(2,i(k),16,10,inter); f_ber2(k)=f(1) end semilogy(i,f_ber2,'g-s') hold on, % disp('- Tinh BER cua ma Kasami:'), f_ber3=zeros(1,length(i)); for k=1:11 f=mtawgn(3,i(k),16,10,inter); f_ber3(k)=f(1) end semilogy(i,f_ber3,'r-*') semilogy([8],[.12],'w-'), semilogy([9],[.123],'w-') % dung de tao hai dong chu thich xlabel('No.of Users'),ylabel('BER') axis([0 50 001 1]) legend('Walsh code','Gold code','Kasami code','SNR=10dB','AWGN',4)  h2_13.m clc, figure, i=5:5:40; inter=1000; % F = mtcdma(code,K,M,SNR,iteration) % Parameter % code : = Walsh, = Gold, = Kasami, = M-sequence % K : No of Users % M : No of sequence which we use in the G(n) sequence set = M-ary % SNR : SNR (dB) % iteration : iteration number = symbol number(=10000) disp('- Tinh BER cua ma Walsh:'), f_ber1=zeros(1,length(i)); for k=1:8 f=mtcdma(1,10,16,i(k),inter); f_ber1(k)=f(1) end semilogy(i,f_ber1,'b-o') hold on, grid on % disp('- Tinh BER cua ma Gold:'), f_ber2=zeros(1,length(i)); for k=1:8 f=mtcdma(2,10,16,i(k),inter); f_ber2(k)=f(1) end semilogy(i,f_ber2,'g-s') hold on, % disp('- Tinh BER cua ma Kasami:'), f_ber3=zeros(1,length(i)); for k=1:8 f=mtcdma(3,10,16,i(k),inter); f_ber3(k)=f(1) end semilogy(i,f_ber3,'r-*') semilogy([8],[.12],'w-'), semilogy([9],[.123],'w-') % dung de tao hai dong chu thich xlabel('SNR (dB)'),ylabel('BER') axis([5 40 01 1]) legend('Walsh code','Gold code','Kasami code','No.of User=10','Multi-path Fading')  h2_14.m clc, home, figure, i=[3 10 15]; inter=1000; % F = mtcAdap(code,K,MaxM,SNR,iteration) % Parameter % code : = Walsh, = Gold, = Kasami, = M-sequence % K : No of Users % MaxM : Max No of sequence which we use in the G(n) sequence set = M-ary % SNR : SNR (dB) % iteration : iteration number = symbol number % disp('- Tinh BER cua MTC CDMA co thich nghi toc do:'), f_ber1=zeros(1,length(i)); for k=1:5 f=mtcAdap(1,i(k),16,40,inter); f_ber1(k)=f(2) end semilogy(i,f_ber1,'b-o') hold on, grid on % disp('- Tinh BER cua MTC CDMA khong thich nghi toc do:'), f_ber2=zeros(1,length(i)); for k=1:5 f=mtcdma(1,i(k),16,40,inter); f_ber2(k)=f(1) end semilogy(i,f_ber2,'g-s') hold on, % semilogy([8],[.01],'w-') % semilogy([9],[.123],'w-') dung de tao hai dong chu thich xlabel('No.of Users'),ylabel('BER') axis([3 15 0004 1]) legend('MTC CDMA with Adaptation','MTC CDMA without Adaptation','SNR=40dB',4)  h2_15.m clc, figure, i=[3 10 15]; inter=2000; % F = mtcAdap(code,K,MaxM,SNR,iteration) % Parameter % code : = Walsh, = Gold, = Kasami, = M-sequence % K : No of Users % MaxM : Max No of sequence which we use in the G(n) sequence set = M-ary % SNR : SNR (dB) % iteration : iteration number = symbol number % disp('- Tinh BER cua MTC CDMA kenh AWGN:'), f_ber1=zeros(1,length(i)); for k=1:5 f=mtawgn(1,i(k),16,10,inter); f_ber1(k)=f(1) end semilogy(i,f_ber1,'b-o') hold on, grid on % disp('- Tinh BER cua MTC CDMA kenh fading:'), f_ber2=zeros(1,length(i)); for k=1:5 f=mtcdma(1,i(k),16,40,inter); f_ber2(k)=f(1) end semilogy(i,f_ber2,'g-s') hold on, % semilogy([8],[.012],'w-') % semilogy([9],[.123],'w-') dung de tao hai dong chu thich xlabel('No.of Users'),ylabel('BER') axis([3 15 001 2]) legend('MTC CDMA in AWGN(SNR=10dB)','MTC CDMA in Fading(SNR=40dB)','M=16',4)  h2_16.m clc, figure, i=5:5:45; inter=1000; % -disp('- Tinh BER cua MTC CDMA khong co thich nghi toc do:'), f_ber1=zeros(1,length(i)); for k=1:9 f=mtcdma(1,10,16,i(k),inter); f_ber1(k)=f(1) end semilogy(i,f_ber1,'b-o') hold on, grid on % disp('- Tinh BER cua MTC-MC CDMA khong co thich nghi toc do:'), f_ber2=zeros(1,length(i)); for k=1:9 f=mccdma(1,10,16,16,i(k),inter); f_ber2(k)=f(1) end semilogy(i,f_ber2,'g-*') hold on, % disp('- Tinh BER cua MTC-MC CDMA co thich nghi toc do:'), f_ber3=zeros(1,length(i)); for k=1:9 f=mcAdap(1,10,32,16,i(k),inter); f_ber3(k)=f(1) end semilogy(i,f_ber3,'r-s') % semilogy([8],[.12],'w-') % semilogy([9],[.123],'w-') dung de tao hai dong chu thich xlabel('SNR (dB)'),ylabel('BER') axis([5 45 00007 5]) legend('MTC CDMA without Adaptation','MTC-MC CDMA without Adaptation','MTC-MC CDMA with Adaptation') ... i thi u v h th ng CDMA lai ghép Ph nII : H th ng lai ghép CDMA đa sóng mang đa mư Ph n I Gi i thi u h th ng CDMA lai ghép 1.1 K thu t tr i ph CDMA [9] [10] K thu t tr i ph CDMA, v lý thuy t b... hình h th ng CDMA đa mã Ph n II: H th ng lai ghép CDMA đa sóng mang đa mã 27 30 2.1 Mô hình h th ng MTC-MC CDMA 30 2.2 Phân tích h th ng MTC-MC CDMA 33 2.3 Hi u n ng c a h th ng MTC-MC CDMA 38 2.4... thi u H th ng CDMA lai ghép 11 1.1 K thu t tr i ph CDMA 11 1.2 H th ng CDMA đa sóng mang 13 1.2.1 Mô t h th ng truy n d n a sóng mang 13 1.2.2 Mô hình h th ng lai ghép CDMA đa sóng mang 17 1.2.3

Ngày đăng: 25/01/2017, 09:31

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan