Ernte1893
Newbie level 3
- Joined
- Jul 16, 2014
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 43
Hey,
I am building a model for a transceiver and I am struggling atm with the convolution coding and especially its decoding ! I want to use the following code rates:
1/3; 1/2; 5/8; 3/4;
For the first two I use different trellis operators (still standard ones) and since I don't use any noise the BER is obviously 0.
For the 3rd and 4th rate I deleted some samples and added a zero pattern at the end (instead of the deleted samples). Am I doing something wrong ? I get really high BER values for the 3rd and 4th rate (0.2 - 0.5 !).
I am building a model for a transceiver and I am struggling atm with the convolution coding and especially its decoding ! I want to use the following code rates:
1/3; 1/2; 5/8; 3/4;
For the first two I use different trellis operators (still standard ones) and since I don't use any noise the BER is obviously 0.
For the 3rd and 4th rate I deleted some samples and added a zero pattern at the end (instead of the deleted samples). Am I doing something wrong ? I get really high BER values for the 3rd and 4th rate (0.2 - 0.5 !).
Code Matlab M - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 % FEC Code rate selection: k/n : k = information bits, n = total bits coderate = 2; % 0 means no puncturing but coding rate of 1/3 = size: 3 % 1 means puncturing (coding rate of 1/2 ) = size: 2 % 2 means puncturing (coding rate of 5/8 ) = size: 8 % 3 means puncturing (coding rate of 3/4 ) = size: 4 rate = [1/3 1/2 5/8 3/4]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% QPSK transmitter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Create SU payload with FEC % Create Payload rand_data = randn(1,data); Input = zeros(1,data); for i = 1:data if rand_data(i) >= 0.5 Input(i) = 1; else Input(i) = 0; end end % FEC % Convolution Coding: for each input bit, there are 2 redundant bits concatenated: % a -> [ a a a ]; trellis = poly2trellis(7,[171 165 133]); coded_data = convenc(Input,trellis); % Puncturing: % depending on the code rate, the signal has to be changed as followed switch coderate case 0 % Stays the same: 1/3 case 1 % a -> [ a a ] : 1/2 coded_data(2:3:end) = []; case 2 % [ a b c d e ] -> [ a a b c c d e e ] : 5/8 coded_data(3:15:end) = []; coded_data(3:14:end) = []; coded_data(3:13:end) = []; coded_data(6:12:end) = []; coded_data(6:11:end) = []; coded_data(6:10:end) = []; coded_data(9:9:end) = []; case 3 % [ a b c d ] -> [ a a b c ] : 3/4 coded_data(3:9:end) = []; coded_data(3:8:end) = []; coded_data(3:7:end) = []; coded_data(4:6:end) = []; coded_data(4:5:end) = []; otherwise end Signal = coded_data; % According to selected code rate, zeros are added to the signal decoded = zeros(1,size(Signal,2)*rate(coderate+1)*3); switch coderate case 0 % Stays the same: 1/3 decoded = Signal; Output = vitdec(decoded,trellis,12,'trunc','hard'); case 1 % [ a a ] New trellis operator: 1/2 trellis2 = poly2trellis(7,[171 133]); decoded = Signal; Output = vitdec(decoded,trellis2,12,'trunc','hard'); case 2 % [ a a b c c d e e ] -> [ a a 0 0 0 b c c 0 0 0 d e e 0 ] : 5/8 decoded(1:15:end) = Signal(1:8:end); decoded(2:15:end) = Signal(2:8:end); decoded(6:15:end) = Signal(3:8:end); decoded(7:15:end) = Signal(4:8:end); decoded(8:15:end) = Signal(5:8:end); decoded(12:15:end) = Signal(6:8:end); decoded(13:15:end) = Signal(7:8:end); decoded(14:15:end) = Signal(8:8:end); Output = vitdec(decoded,trellis,96,'trunc','hard'); case 3 % [ a a b c ] -> [ a a 0 0 0 b 0 0 c ]: 3/4 decoded(1:9:end) = Signal(1:4:end); decoded(2:9:end) = Signal(2:4:end); decoded(6:9:end) = Signal(3:4:end); decoded(9:9:end) = Signal(4:4:end); Output = vitdec(decoded,trellis,96,'trunc','hard'); otherwise end % Viterbi Decoder for convolutianally encoded data [number,ratio]=biterr(Output,Input); % Bit error rate