Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
8PSK-TCM modulation Simulation

Subject: 8PSK-TCM modulation Simulation

From: tina

Date: 5 Feb, 2011 20:39:03

Message: 1 of 3

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');

Subject: 8PSK-TCM modulation Simulation

From: mohammad

Date: 12 May, 2011 07:31:32

Message: 2 of 3

I think you can write it so simple,
there is some problem in demapping.
I can't come to this site more
please contact for consult together about it
my mail is as mr dot mirarab dot gmail dot com

Subject: 8PSK-TCM modulation Simulation

From: chethan

Date: 18 Nov, 2012 09:28:15

Message: 3 of 3

hi i wan 8-psk , 16-psk and qam , 4-qam , 8-qam ,16-qam 32-qam 64-qam...... working codes can any pl help

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us