Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 8PSK-TCM modulation Simulation
Replies: 2   Last Post: Nov 18, 2012 4:28 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
tina

Posts: 2
Registered: 1/17/11
8PSK-TCM modulation Simulation
Posted: Feb 5, 2011 3:39 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In The Name of GOD

Dear all,
I wrote a mfile that it simulates BER of a 8PSK-TCM modulation over a fading channel, It seems to work properly, but I don't know is it what we want in a TCM transmitter or not. I would be very happy if any one tell me it is true or not. this is my code:
% In The Name of GOD

clear
% 8PSK-TCM simulation

M = 8;
tx = randint(1,1000);
conv_input = tx(1:2:end);
uncode_data = tx(2:2:end);

% Convolutional encoder
trellis = poly2trellis(7 ,[str2double(dec2base(bin2dec('1011011'),M)) str2double(dec2base(bin2dec('1111001'),M))]);
code_data = convenc(conv_input,trellis);

% partitioning
partition=[pskmod(1,M,0,'gray') pskmod(7,M,0,'gray');
pskmod(2,M,0,'gray') pskmod(4,M,0,'gray');
pskmod(3,M,0,'gray') pskmod(5,M,0,'gray');
pskmod(0,M,0,'gray') pskmod(6,M,0,'gray')];

% TCM Modulation
txSig = zeros(1,length(uncode_data));
for k = 1: length(uncode_data)
i = code_data(2*k-1)+code_data(2*k)*2;
txSig(1,k)=partition(i+1,uncode_data(k)+1);
end

% Effect of Rayleigh channel
x = randn(length(txSig),1);
y = randn(length(txSig),1);
ray = sqrt(0.5*(x.^2+y.^2));
fadeSig = txSig.*ray';

EbNo = (0:2:30);
k = log2(8);
SNR = EbNo+10*log10(k);
BER = zeros(1,length(EbNo));
for n = 1:length(SNR)
% Add Gaussian noise.
rxSig = awgn(fadeSig,SNR(n),'measured');
% Demodulate.
rx = pskdemod(rxSig, M,0,'gray');

% Decode
r_code = zeros(1,length(rx)*2);
r_uncode = zeros(1,length(rx));
for i=1:length(rx)
switch rx(i)
case 0
r_code(1,2*i-1) = 1;
r_code(1,2*i) = 1;
r_uncode(1,i) = 0;
case 1
r_code(1,2*i-1) = 0;
r_code(1,2*i) = 0;
r_uncode(1,i) = 0;
case 2
r_code(1,2*i-1) = 1;
r_code(1,2*i) = 0;
r_uncode(1,i) = 0;
case 3
r_code(1,2*i-1) = 0;
r_code(1,2*i) = 1;
r_uncode(1,i) = 0;
case 4
r_code(1,2*i-1) = 1;
r_code(1,2*i) = 0;
r_uncode(1,i) = 1;
case 5
r_code(1,2*i-1) = 0;
r_code(1,2*i) = 1;
r_uncode(1,i) = 1;
case 6
r_code(1,2*i-1) = 1;
r_code(1,2*i) = 1;
r_uncode(1,i) = 1;
case 7
r_code(1,2*i-1) = 0;
r_code(1,2*i) = 0;
r_uncode(1,i) = 1;
otherwise
error('This is impossible')
end
decrx1 = vitdec(r_code,trellis, 2,'trunc', 'hard');
decrx(1:2:length(tx))= decrx1;
decrx(2:2:length(tx))= r_uncode;
end
[nErrors, BER(1,n)] = biterr(tx,decrx);
end

semilogy(EbNo,BER,'b*',EbNo,BER,'b');grid on;
legend('Theoretical BER','Empirical BER');
xlabel('EbNo (dB)'); ylabel('BER');
title('TCM Modulation with a convolutional encoder in a Rayleigh channel');



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.