版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
1、任意發(fā)送天線,任意接收天線的stbc-mimo-ofdm的matlab程序(arbitrary transmit antenna, arbitrary receive antenna stbc-mimo-ofdm matlab program)clear all;i = sqrt (- 1);ifft _ bin _ length = 512% 傅立葉變換抽樣點數(shù)目;carrier _ count = 100% 子載波數(shù)目;_ symbols per _ carrier = 66% 符號數(shù) / 載波;_ cp length = 10;% 循環(huán)前綴長度_ addprefix length = i
2、fft _ bin _ length + cp _ length;_ psk m = 4;_ _ bits per symbol = log2 (m _ psk / 符號 位數(shù)%);% 1 - 2 = 2; 1 + j + j;% alamouti scheme x1 x2 - x1; x2 * * 二天線發(fā)送矩陣or - 1 - 2 = j 1 + 2 + 3; 3 + j j 0; 0 + 1 0 - 3 j; j + j + 2% ; for x1 - x2 - x1 x2 x3; * * * * x3 x1 0; 0; 0 - x3 x2 三天線發(fā)送矩陣 * *co _ time =
3、size (o (1);nt = size (or, 2);% 發(fā)射天線數(shù)目nr = 2% 接收天線數(shù)目;num _ x = 1;for cc _ ro = 1: co _ timefor cc _ co = 1: ntnum _ x = max (abs (_ x num, real (or (cc _ ro, cc _ co);endendco _ x = zeros (_ x num, 1);for _ ro = 1: co _ time% 計算delta, epsilon eta and conj matricesfor _ co = 1: nt% 用于確定矩陣 or 中元素的位置,
4、符號以及共軛情況if abs (real or _ ro, with _ co) = 0delta (with _ ro, abs (real or _ ro, with _ co sign (=) (real or _ ro, with _ co);epsilon (_ ro, abs (real or _ ro, with _ co) = _ co;co _ (abs (x (real or _ ro, with _ co), x (1) = abs (co _ real (or (_ ro, with _ co) + 1), 1);eta (abs (real or _ ro, with
5、 _ co), co _ (abs) x (real or _ ro, with _ co), 1) = _ ro;the _ mt (with _ ro, abs (real or _ ro, with _ co) (or = imag (_ ro, with _ co);endendendeta = eta. ;eta = sort (eta);eta = eta. ;carriers = (1: carrier _ count (floor) + (ifft _ bin _ length / 4) - floor (carrier _ count / 2);% 坐標: (1 to 100
6、) + 14 = (15: 114)conjugate _ carriers = length ifft _ bin _ carriers + 2; 256 (15% 坐標: 114) + 1 = 257 - (15: 114) = (242: 143)tx _ training _ symbols = training _ symbol (nt, carrier _ count);baseband _ out _ length = carrier _ count * symbols _ per _ carrier;_ snr = 3% 最小信噪比 min;_ max snr = 15% 最大
7、信噪比;graph _ inf _ bit = zeros (snr snr _ _ max - min + 1.2% 繪圖信息存儲矩陣, nr);graph _ inf _ sym = zeros (snr snr _ _ max - min + 1.2, nr);_ snr for snr = min: max snr _% 開始仿真clcdisp (wait until snr =); disp (snr _ max);snrn _ err _ sym = zeros (1, id);n _ _ bit err = zeros (1, id);i _ sym = zeros (1, id
8、);i _ bit = zeros (1, id);re _ met _ sym _ buf = zeros (carrier _ count, symbols _ per _ carrier, nr);re _ met _ bit = zeros (baseband _ out _ length, _ _ bits per symbol, nr);baseband _ out = round (rand (baseband _ out _ length, _ _ bits per symbol);% 生成隨機數(shù)用于仿真of _ data = bi2de (baseband _ out 二進制
9、向十進制轉(zhuǎn)換%);data _ buf = pskmod (_ data _ psk, m, 0);% psk調(diào)制carrier _ matrix = reshape (data _ buf, carrier _ count, _ _ symbols per carrier);for tt = 1: nt: symbols _ per _ carrier% 取數(shù)為空時編碼做準備, 此處每次取每個子載波上連續(xù)的兩個數(shù)data = ;for ii = 1: nttx _ buf _ buf = carrier _ matrix (:, tt + ii - 1);data = date; tx _
10、buf _ buf;endxx = zeros (co _ time * carrier _ count, nt);it is con _ r = 1: co 進行空時編碼 _ time%it is con _ c = 1: ntif abs (real (con _ r, con _ (c) = 0if imag (con _ r, con _ (c) = = 0xx (con _ r - 1) * carrier _ count + 1: con _ r * carrier _ count, con _ (c) = date (abs (real (con _ r, con _ (c) -
11、 1) * carrier _ count + 1: abs (real (con _ r, con _ (c)* carrier _ count, 1) * sign (real (con _ r, con _ (c);elsexx (con _ r - 1) * carrier _ count + 1: con _ r * carrier _ count, con _ (c) = b (date (abs (real (con _ r, con _ (c) - 1) * carrier _ count + 1: abs (real (the (con _ r, con _ (c)* car
12、rier _ count, 1) * sign (real (con _ r, con _ (c);endendend空時編碼結(jié)束 end%xx = tx _ training _ symbols; xx;% 添加訓練序列rx _ buf = zeros (1, addprefix _ length * (co _ time + 1), nr);is rev: nr = 1for (ii = 1: nttx _ buf = reshape (xx (:, (ii), carrier _ count, co _ time + 1);ifft _ tx _ buf = zeros (ifft _
13、bin _ length, co _ time + 1);ifft _ tx _ buf (carriers,:) = tx _ buf (1: carrier _ count:);ifft _ tx _ buf (conjugate _ carriers:) = b (tx _ buf (1: carrier _ count:);the team _ matrix = ifft (ifft _ tx _ buf);the team _ matrix = team _ matrix (ifft _ bin _ length - cp _ length + 1): ifft _ bin _ le
14、ngth:); time _ matrix;tx = time _ matrix (:) ;% -% d = randint (1,4, 1,7);% 4多經(jīng)信道模擬% = randint (1,4, 2,7) / 10;tx _ tmp = tx;d = 4,5,6,2; 4,5,6,2; 4,5,6,2; 4,5,6,2;a = 0.2,0.3,0.4,0.5; 0.2,0.3,0.4,0.5; 0.2,0.3,0.4,0.5; 0.2,0.3,0.4,0.5;for j = 1: size (d 2)copy = zeros (size (tx);for kk = 1 + d (i, j
15、): length (tx)copy (kk) = a (ii, tx (kk jj) * d (ii, jj);endtmp = tx tx _ _ tmp + copy;end-%txch = awgn (tx _ tmp, snr, measured );% 添加高斯白噪聲rx _ buff (1: rev) = rx _ buff (1: rev) + txch;end_ spectrum rx = reshape (rx _ buff (1,:, rev), addprefix _ length, co _ time + 1);_ spectrum rx = rx _ spectru
16、m (cp _ length + 1: addprefix _ length:);fft _ tx _ buff = zeros (ifft _ bin _ length, co _ time + 1);fft _ tx _ buff = fft (rx _ spectrum);the spectrum _ matrix = fft _ tx _ buff (carriers,:);y _ buff = (spectrum _ matrix (:, 2: co _ time + 1);y = (y _ conj _ buff buff );the spectrum _ matrix1 = sp
17、ectrum _ matrix (: 1);wk = exp (- 2 * pi / carrier _ count) * i);l = 10;p = zeros (l * * * * nt, 1);for j = 1: ntfor l = 0: l - 1for kk = 0: carrier _ count - 1p (l + (j - 1) * l + 1,1) = p (l + (j - 1) * l + 1,1) + spectrum _ matrix1 (kk + 1,1) * conj (tx _ training _ symbols (kk + 1, j) (-) * wk (
18、kk * l);endendendzeros% q = (l * l * * * * nt, nt);% for ii = 1: nt% for j = 1: nt% for the l1 = 0: l - 1% for l2 = 0: l - 1% for kk = 0: carrier _ count - 1% q (l2 + (i - 1) * l + 1, l1 + (j - 1) * l + 1) = q (l2 + (i - 1) * l + 1, l1 + (j - 1) * l + 1) + tx _ training _ symbols (kk + 1 conj, ii) *
19、 (tx _ training _ symbols (kk + 1, j) (-) * wk (kk * (l1 + l2);end%end%end%end%end% h = and (q) * p;h = p / carrier _ count;to _ buff = zeros (carrier _ count, nt);for ii = 1: ntfor kk = 0: carrier _ count - 1for l = 0: l - 1to _ buff (kk + 1, ii) = h _ buff (kk + 1,(ii) + h (l + (ii, 1) * l + 1,1)
20、* wk (kk * l);thanthanthanh _ buf = conj (h _ buf );rac = ;ct = 1: carrier _ county = y _ buf (kk);h = h _ buf (kk);for co _ ii = 1: num _ xfor co _ tt = 1: size (eta 2)if eta (co _ ii, co _ tt = 0)if confirmed _ mt (eta (co _ ii, co _ tt), co _ ii) = = 0r _ (eta (co _ ii, co _ tt): co _ ii) = y (et
21、a (co _ ii, co _ tt):);a _ (eta (co _ ii, co _ tt): co _ ii) = conj (h (epsilon (eta (co _ ii, co _ tt), co _ ii):);elser _ (eta (co _ ii, co _ tt): co _ ii) = conj (y (eta (co _ ii, co _ tt):);a _ (eta (co _ ii, co _ tt): co _ ii) = h (epsilon (eta (co _ ii, co _ tt), co _ ii):);thanthanthanthanrr
22、= zeroes (num _ x 1);for iii = 1: num _ x% generate decision statistics of the transmitted signal xifor iii = 1: size (eta 2)if eta (iii, iii) = 0rr (iii, 1) = rr (iii, 1) + r _ (eta (iii, iii) 1, (iii) * (a _ (eta (iii, iii) 1, (iii) * delta (eta (iii, iii) (iii);thanthanthanrac = rrr; conj (rr);th
23、anr _ symbols = pskdemod (rrr, m _ bank, 0);re _ met _ symbols _ buf (: tt: tt + nt 1 rev) = r _ symbols;thanthanre _ met _ symbols = zeroes (baseband _ out _ length, 1 point);for rev = 1: nore _ met _ symbols _ buf _ buf = u.a. _ met _ symbols _ buf (:,:, rev);re _ met _ symbols (:, 1 rev) = re _ m
24、et _ symbols _ buf _ buf (:);re _ met _ bits (:,:, rev) = de2bi (re _ met _ symbols (:, 1 rev);for con _ dec _ ro = 1: baseband _ out _ lengthif re _ met _ symbols (con _ dec _ ro, 1 rev) = the _ data (con _ dec _ ro, 1)n _ err _ symbols (1, rev) = n _ err _ symbols (1, rev) + 1;for con _ dec _ co =
25、 1: _ _ bits per symbolif re _ met _ bits (con _ dec _ ro, con _ dec _ co., rev) = baseband _ out (con _ dec _ ro, con _ dec _ co.)n _ err _ piece (1, rev) = n _ err _ piece (1, rev) + 1;endendendendgraph _ inf _ sym (snr and snr _ my + 1,1, rev) = snr;graph _ inf _ piece (snr and snr _ my + 1,1, re
26、v) = snr;per _ sym (1, rev) = n _ err _ sym (1, rev) / (baseband _ out _ length);% count number of error bits and symbolsgraph _ inf _ sym (snr and snr _ my + 1,2, rev) = per _ sym (1, rev.);per _ piece (1, rev) = n _ err _ piece (1, rev) / (baseband _ out _ length * _ bits per symbol _);graph _ inf
27、 _ piece (snr and snr _ my + 1,2, rev) = per _ piece (1, rev.);endendfor rev = 1: rev.x _ sym = graph _ inf _ sym (:, 1, rev);% generate ploty _ sym = graph _ inf _ sym (:, 2 rev.);subplot (no, 1, rev.);semilogy (x _ sym, y _ sym, k - v );axis (2, 16 a 0.0001 to 1);xlabel (snr, db);ylabel (symbol error probability);grid on% hold onend% hold off% for rev = 1: rev.x% _ piece = graph _ inf _ piece (:, 1, rev.);% y _ piece = graph _ inf _ piece (:, 2 rev.);subplot% (2,1,2);semilogy% (x _ piece
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 公司運營與管理
- 云南省昭通市昭通一中教研聯(lián)盟2024-2025學年高二上學期期中質(zhì)量檢測物理試卷 (A卷)(含解析)
- 腰椎修門氏病
- 廢舊機動車回收拆解及加工項目可行性研究報告
- 輸液反應應急培訓
- 體育賽事工會財務審計
- 白血病介紹英語
- 體育場館分包施工協(xié)議
- 稀土工程分包協(xié)議
- 咖啡機租賃合同樣本
- 中藥項目投資合同范例
- 2024-2025學年上海市普陀區(qū)八年級(上)期中數(shù)學試卷
- 假期補課協(xié)議書
- 電子商務支付結(jié)算系統(tǒng)開發(fā)合同
- 服務質(zhì)量、保證措施
- (必練)廣東省軍隊文職(經(jīng)濟學)近年考試真題試題庫(含答案)
- 含羞草天氣課件
- 2024年安全生產(chǎn)知識競賽考試題庫及答案(共五套)
- 22《鳥的天堂》課件
- 農(nóng)業(yè)灌溉裝置市場環(huán)境與對策分析
- 新疆烏魯木齊市第十一中學2024-2025學年八年級上學期期中道德與法治試卷
評論
0/150
提交評論