|
LDPC非常好用的工具。
0.png (69.99 KB, 下載次數(shù): 58)
下載附件
2017-5-25 15:35 上傳
Matlab程序源程序如下:
- %--------------------------------------------------------------------------
- %-----Chamitha-de-Alwis----------------------------------------------------
- %-----University-of-Surrey-------------------------------------------------
- %-----chamithadealwis@hotmail.com------------------------------------------
- %--------------------------------------------------------------------------
- clear
- clc
- clear
- %--------------------------------------------------------------------------
- %-----Set-Simulation-Parameters--------------------------------------------
- %--------------------------------------------------------------------------
- snrs = [10 13 15]; %SNR values
- codeRate = 9/10; %Possible values for codeRate are 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, and 9/10. The block length of the code is 64800
- mod_order = 4; %PSK Modulation Order
- frames = 2500; %Number of frames (fame size is 64800 bits) to be simulated
- %--------------------------------------------------------------------------
- rounds = size(snrs,2);
- messageLength = round(64800*codeRate);
- for run = 1:1:rounds
- framepattern = [];
-
- snrvalue = snrs(run);
- H = dvbs2ldpc(codeRate);
- %spy(H); % Visualize the location of nonzero elements in H.
- errors = 0;
- hEnc = comm.LDPCEncoder(H);
- hMod = comm.PSKModulator(mod_order, 'BitInput',true);
- hChan = comm.MIMOChannel('MaximumDopplerShift', 0, 'NumTransmitAntennas',1,'NumReceiveAntennas',1, 'TransmitCorrelationMatrix', 1, 'ReceiveCorrelationMatrix', 1, 'PathGainsOutputPort', true);
- hAWGN = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',snrvalue);
- % hDemod = comm.PSKDemodulator(4, 'BitOutput',true,'DecisionMethod','Approximate log-likelihood ratio',...
- % 'Variance', 1/10^(hChan.SNR/10));
- hDemod = comm.PSKDemodulator(4, 'BitOutput',true,'DecisionMethod','Approximate log-likelihood ratio');
- hDec = comm.LDPCDecoder(H,'DecisionMethod', 'Soft decision');
- %hError = comm.ErrorRate;
- for counter = 1:frames
- receiveddataBits = [];
- data = logical(randi([0 1], messageLength, 1));
- % data = randi([0 hMod.ModulationOrder-1], messageLength, 1);
- encodedData = step(hEnc, data);
-
-
-
- modSignal = step(hMod, encodedData);
-
-
- % Transmit through Rayleigh and AWGN channels
- [chanOut, pathGains] = step(hChan, modSignal);
- receivedSignal = step(hAWGN, chanOut);
- demodSignal = step(hDemod, receivedSignal);
- receivedBits = step(hDec, demodSignal);
- %errorStats = step(hError, data, receivedBits);
-
- for i=1:1:messageLength
- if receivedBits(i,1) >= 0
- receiveddataBit = 0;
- else
- receiveddataBit = 1;
- end
- receiveddataBits = [receiveddataBits; receiveddataBit];
- end
-
- newErrors = nnz(receiveddataBits-data);
- errors = errors + newErrors;
- if newErrors == 0
- addFramepattern = 1;
- else
- addFramepattern = 0;
- end
- framepattern = [framepattern addFramepattern];
-
- clc
- run
- counter
- errors
- code_errors = (size(framepattern,2) - nnz(framepattern));
- code_errors
- end
- SumErrors(run) = errors;
- ……………………
- …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
LDPC_AWGN.zip
(2.17 KB, 下載次數(shù): 32)
2017-5-25 11:39 上傳
點(diǎn)擊文件名下載附件
LDPC編碼 下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|