You are on page 1of 20

Title: Implementation of Smart Antenna Design in MIMO-OFDM System

Objectives:

1. To design multiple antenna system for high data rates signal transmission.

2. To apply OFDM Techniques to reduce multipath Rayleigh Fading Channel.

3. To evaluate Bit Error rate (BER) and signal-to-noise (SNR) ratio of the system.

Introduction:

Future wireless communications deployed smart antenna systems to gain high speed data transmission.
The system should carries variable input packets to meet the requirements by the users with maximum
bandwidth and low power consumption. The idea of smart antenna is having the number of transmitters
and also receivers. The multiple input and multiple output (MIMO) system shown in Figure 1, which
covers the development of Frequency Division Multiplexing (FDM) and Orthogonal Frequency Division
Multiplexing (OFDM). Figure 2 and Figure 3 shows the system model of a transmitter and a receiver
respectively.

Figure 1
Figure 2

Figure 3

Procedure:

1. Produce a complete system which illustrated in Figure 4.


2. Complete the coding below

n = 7;

k=4;

msg_size=100;

msg=randint (msg_size,k,[0,1]);

Figure (1); input signal

numPlot=4;

stem([0:numPlot-1], msg (1,: ), ‘ko’);

axis ([0 numPlot -0.5 1.5]);

xlabel (‘Time’);

ylabel (‘Amplitude’);

title (‘Input Signal’);

grid;

%Smart Antenna Setting

For z=1 : msg_size

For t=1:k

if t==1;

ant1(z,t)=msg(z,1);
ant2(z,t)=abs(-conj (msg (z,2)));

ant3(z,t)=conj (msg(z,3));

ant4(z,4) = 0;

elseif t==2;

ant1(z,t)=msg (z,2);

ant2(z,t)=conj(msg(z,1));

ant3(z,t) = 0;

ant4(z,4) = conj (msg(z,3));

elseif t==3;

ant1(z,t)=conj (msg(z,3));

ant2(z,t)=0;

ant3(z,t) = abs (-conj (msg(z,1)));

ant4(z,4) = abs (-conj (msg(z,2)));

elseif t==4;

ant1 (z,t) = 0;

ant2(z,t) = msg (z,3);

ant3(z,t) = msg(z,2);

ant4(z,4)= msg(z,1);

end

end

end

%Encode Signals

Ant1

Ant2
Ant3

Ant4

Code1=encode (ant1,n,k, ‘cyclic/binary’);

Code2=encode (ant2,n,k, ‘cyclic/binary’);

Code3=encode (ant3,n,k, ‘cyclic/binary’);

Code4=encode (ant4,n,k, ‘cyclic/binary’);

%MIMO Signals

Figure (2); For Antenna 1

SubPlot (1,4,1);

Stem ([0:numPlot-1], ant1(1,:), ‘go’);

Axis([0 numPlot -0.5 1.5]);

Xlabel (‘Time’);

Ylabel (‘Amplitude’);

Title (‘Signal Antenna 1’);

Grid;

SubPlot (1,4,2);

Stem ([0:numPlot-1], ant2(1,:), ‘mo’);

Axis([0 numPlot -0.5 1.5]);

Xlabel (‘Time’);

Ylabel (‘Amplitude’);

Title (‘Signal Antenna 2’);

Grid;

SubPlot (1,4,3);

Stem ([0:numPlot-1], ant3(1,:), ‘ro’);

Axis([0 numPlot -0.5 1.5]);

Xlabel (‘Time’);
Ylabel (‘Amplitude’);

Title (‘Signal Antenna 3’);

Grid;

SubPlot (1,4,4);

Stem ([0:numPlot-1], ant4(1,:), ‘bo’);

Axis([0 numPlot -0.5 1.5]);

Xlabel (‘Time’);

Ylabel (‘Amplitude’);

Title (‘Signal Antenna 4’);

Grid;

%Encode All Signals

Figure (3)

subPlot (1,4,1);

numPlot = 7;

stem ([0:numPlot-1], code1(1,:), ‘go’);

axis ([0 numPlot -0.5 1.5]);

xlabel (‘Time’);

ylabel(‘Amplitude’);

Title (‘Encode Signal Antenna 1’);

Grid;

subPlot (1,4,2);

numPlot = 7;

stem ([0:numPlot-1], code2(1,:), ‘mo’);

axis ([0 numPlot -0.5 1.5]);

xlabel (‘Time’);

ylabel(‘Amplitude’);

Title (‘Encode Signal Antenna 2’);


Grid;

subPlot (1,4,3);

numPlot = 7;

stem ([0:numPlot-1], code3(1,:), ‘ro’);

axis ([0 numPlot -0.5 1.5]);

xlabel (‘Time’);

ylabel(‘Amplitude’);

Title (‘Encode Signal Antenna 3’);

Grid;

subPlot (1,4,4);

numPlot = 7;

stem ([0:numPlot-1], code1(1,:), ‘bo’);

axis ([0 numPlot -0.5 1.5]);

xlabel (‘Time’);

ylabel(‘Amplitude’);

Title (‘Encode Signal Antenna 4’);

Grid;

%Modulation & Add Noise

Fd=1/2;

Fc1 = 1;

Fc2 = 2;

Fc3 = 3;

Fc4 = 4;

Fs = 32; sampling time

N=fs/fd;

M=4;

SNRpBit = 14;

SNR= SNRpBit/log2(M);
%Modulate All Signals

%Modulation Antenna 1

For z = 1:msg_size

K1= code1(z,: );

Msg_ant1 = k1;

Grayencod=bitxor([0: M-1], floor ([0:M-1], floor ([0:M-1]/2));

Msg_gr_orig1=grayencod(msg_ant1 +1);

Msg_mod1=dmod(msg_gr_orig1,fc1,fd,fs,’psk’, M);

%IFFT – frequency domain

If sig1=ifft(msg_mod1);

Msg_tx1(z,: )=if_sig1;

%create Rayleigh fading Channel Object

Chan=rayleighchan;

Msg_rx1=filter (chan,if_sig1);

Msg_noise1 (z,: )= msg_rx1);

End

%modulation for Antenna 2

For z = 1:msg_size

K2= code2(z,: );

Msg_ant2 = k2;

Grayencod=bitxor([0: M-1], floor ([0:M-1], floor ([0:M-1]/2));

Msg_gr_orig2=grayencod(msg_ant2 +1);

Msg_mod2=dmod(msg_gr_orig2,fc2,fd,fs,’psk’, M);

%IFFT – frequency domain


If sig2=ifft(msg_mod2);

Msg_tx2(z,: )=if_sig2;

%create Rayleigh fading Channel Object

Chan=rayleighchan;

Msg_rx2=filter (chan,if_sig2);

Msg_noise2 (z,: )= msg_rx2);

End

%Modulate for Antenna 3%

(complete this)

%Modulate for antenna 4%

(complete this)

Figure (4)

%Modulate Signal Antenna 1

subPlot (4,1,1);

numModPlot = numPlot*fs;

t= [0: numModPlot -1/fs

stem(t, msg_mod1 (1:length(t)), ‘g-‘);

axis ([min(t) max(t) -1 1]);

xlabel (‘Time’);

ylabel(‘Amplitude’);

Title (‘QPSK Modulated Signal 1’);

Grid;

%Modulate Signal Antenna 2


(please complete this)

%Modulate Signal Antenna 3

(please complete this)

%Modulate Signal Antenna 4

(please complete this)

Figure (5);

%Modulate the IFFT Signal at Antenna 1

subPlot (4,1,1);

plot (t, if_sig1(1:length(t), ‘g-‘);

axis ([min (t) max (t) -0.04 0.04]);

xlabel (‘Time’);

ylabel (‘Amplitude’);

Title (‘QPSK Modulated Signal 1 After IFFT’);

Grid;

%Modulate the IFFT Signal at Antenna 2

subPlot (4,1,2);

plot (t, if_sig2(1:length(t), ‘m-‘);

axis ([min (t) max (t) -0.04 0.04]);

xlabel (‘Time’);

ylabel (‘Amplitude’);

Title (‘QPSK Modulated Signal 2 After IFFT’);

Grid;

%Modulate the IFFT Signal at Antenna 3

(please complete this)


%Modulate the IFFT Signal at Antenna 4

(please complete this)

Figure (6);

% Modulate + IFFT + Noise Signal antenna 1

subPlot (4,1,1);

plot(t,msg_rx2(1:length(t)), ‘b-‘);

axis ([min(t) max (t) -0.04 0.04]);

xlabel (‘Time’);

ylabel (‘Amplitude’);

title (‘QPSK Modulated Signal 1 After IFFT Add Noise’);

grid;

% Modulate + IFFT + Noise Signal antenna 2

subPlot (4,1,2);

plot(t,msg_rx2(1:length(t)), ‘r-‘);

axis ([min(t) max (t) -0.04 0.04]);

xlabel (‘Time’);

ylabel (‘Amplitude’);

title (‘QPSK Modulated Signal 2 After IFFT Add Noise’);

grid;

% Modulate + IFFT + Noise Signal antenna 3

(please complete this)

% Modulate + IFFT + Noise Signal antenna 4

(please complete this)


Chan = ricianchan (ts,fd,k)

Chan = ricianchan (ts,fd,k,tau, pdb)

Chan = ricianchan (ts,fd,k,tau, pdb, fdLOS)

Chan = ricianchan

%Lower noise (BER) vs higher SNR

Tot_rx1 = sum ((msg_noise1),2);

Tot_rx2 = sum ((msg_noise2),2);

Tot_rx3 = sum ((msg_noise3),2);

Tot_rx4 = sum ((msg_noise4),2);

Tot_ant1_tx = sum ((msg_tx1),2);

Tot_ant2_tx = sum ((msg_tx2),2);

Tot_ant3_tx = sum ((msg_tx3),2);

Tot_ant4_tx = sum ((msg_tx4),2);

For z = 1: msg_size

Tot_ant1 = tot_rx1(z,: )-tot_ant1_tx (z,: );

Tot_ant2 = tot_rx2(z,: )-tot_ant2_tx (z,: );

Tot_ant3 = tot_rx3(z,: )-tot_ant3_tx (z,: );

Tot_ant4 = tot_rx4(z,: )-tot_ant4_tx (z,: );

If tot_ant4<[tot_ant1; tot_ant2; tot_ant3;];

Msg_choosen1 = msg_noise1;

Msg_choosen2 = msg_noise2;

Msg_choosen3 = msg_noise3;
Elseif tot_ant3<[tot_ant1; tot_ant2; tot_ant4;];

Msg_choosen1 = msg_noise1;

Msg_choosen2 = msg_noise2;

Msg_choosen3 = msg_noise4;

Elseif tot_ant2<[tot_ant1; tot_ant3; tot_ant4;];

Msg_choosen1 = msg_noise1;

Msg_choosen2 = msg_noise4;

Msg_choosen3 = msg_noise3;

Else

Msg_choosen1=msg_noise4;

Msg_choosen2=msg_noise2;

Msg_choosen3=msg_noise3;

End

Type (z,: ) = ‘A’;

End

Tot_ant1

Tot_ant2

Tot_ant3

Rxdata1 = fft (msg_choosen1);

%Selection Frequency 1

For z = 1: msg_size

if msg_choosen1==msg_noise1;

fc5=fc1;

code5=code1;
ant5=ant1;

else

fc5=fc4;

code5=code4;

ant5=ant4;

end

end

for z=1: msg_size

msg_rx5=rxdata1(z,: );

msg_gr_demod1=ddemod(real (msg_rx5),fc5,fd,fs,’psk’,M);

[dummy graydecod] = sort (grayencod);

Graydecod=graydecod-1;

Msg_demod1=graydecod(msg_gr_demod1+1);

Noisycode1 (z,: ) =msg_demod1;

End

Msg_demod1=noisycode1 (1,: );

Code_1=noisycode1;

Rxdata2=fft (msg_choosen2);

%Selection Frequency 2

(complete this)

%Selection Frequency 3

(complete this)
Figure (7);

% Antenna 1 After FFT

subPlot (3,1,1);

plot (t, rxdata1(1:length (t)), ‘b-‘);

axis ([min (t) max(t) -0.04 0.04]);

xlabel (‘Time’);

ylabel(‘Amplitude’);

title (‘QPSK received Signal 1 after FFT’);

grid;

% Antenna 2 After FFT

(please complete this)

% Antenna 3 After FFT

(please complete this)

Figure (8)

%Demodulate Signal Antenna 1

subplot (1,3,1);

numPlot=7

stem ([0:numPlot-1],msg_demod1(1:numPlot),’bo’;

hold off;

axis ([0 numPlot -0.5 3.5]);

xlabel(‘Time’);

ylabel (‘Amplitude’);

title (‘QPSK Demodulated Ant 1’);

grid;
%Demodulate Signal Antenna 2

subplot (1,3,2);

numPlot=7

stem ([0:numPlot-1],msg_demod2(1:numPlot),’ro’;

hold off;

axis ([0 numPlot -0.5 3.5]);

xlabel(‘Time’);

ylabel (‘Amplitude’);

title (‘QPSK Demodulated Ant 2’);

grid;

%Demodulate Signal Antenna 3

subplot (1,3,3);

numPlot=7

stem ([0:numPlot-1],msg_demod3(1:numPlot),’mo’;

hold off;

axis ([0 numPlot -0.5 3.5]);

xlabel(‘Time’);

ylabel (‘Amplitude’);

title (‘QPSK Demodulated Ant 3’);

grid;

P=[1 0 1 1];

Parmat = cyclgen (n,p); % this is to produce parity check bit

Trt = syndtable (parmat); % this is to produce matrix

For z=1: msg_size

Recd1=noisycode1(z,: ); % received vector

Syndrome1=rem(recd1*parmat’, 2);
Syndrome_de1=bi2de(syndrome1, ‘left-msb’); % convert to decimal

Corrvect1=trt (1+syndrome_de1, : ); % correction vector

Correctedcode1 (z, : ) = rem (corrvect1+recd1, 2); %correct codeword

End

newmsg1 = decode (correctedcode1, n, k, ‘cyclic’);

p=[1 0 1 1];

parmat = cyclgen (n,p); %produce parity check bit

trt2 = syndtable (parmat); %produce decoding matrix

For z = 1 : msg_size

Recd2=noisycode2 (z,: ); %received vector

syndrome2 = rem(recd2*parmat’, 2);

syndrome_de2=bi2de (syndrome2, ‘left-msb’); %convert binary to decimal

corrvect2 = trt (1+syndrome_de2,: ); % correction vector

correctedcode2 (z, : )=rem(corrvect2 + recd2, 2); %correct code word

end

newmsg2 = decode(correctedcode2, n, k, ‘cyclic’);

p=[1 0 1 1];

parmat = cyclgen (n,p); %produce parity check bit

trt2 = syndtable (parmat); %produce decoding matrix

For z = 1 : msg_size

recd3=noisycode2 (z,: ); %received vector

syndrome3 = rem(recd3*parmat’, 2);

syndrome_de3=bi2de (syndrome3, ‘left-msb’); %convert binary to decimal

corrvect3 = trt (1+syndrome_de3,: ); % correction vector

correctedcode3 (z, : )=rem(corrvect3 + recd3, 3); %correct code word

end

newmsg3 = decode(correctedcode3, n, k, ‘cyclic’);


Figure (9); % output signal

numPlot=4

stem([0:numPlot -1], newmsg3 (1, : ), ‘ko’);

axis ([0 numPlot -0.5 1.5]);

xlabel (‘Time’);

ylabel (‘Apmlitude’);

title (‘Output Signal’);

grid;

[errBit ratBit] = biterr(code5, code_1, log2(M));

[number, ratio1] = biterr (ant5, newmsg1, log2 (M));

pack = 3;

BNRpbit=[5:9:25];

for i=1:pack

[number,ratio1]=biterr(ant5, newmsg1);

ber1(i) = ratio1/msg_size*10;

msg_size=msg_size*10;

%disp ([‘The Bit Error Rate Is’ ,num2str (ratio)];

end

[errBit ratBit] = biterr(code6, code_2, log2(M));

[number, ratio2] = biterr (ant6, newmsg2, log2 (M));

pack = 3;

BNRpbit=[5:9:25];

for i=1:pack

[number,ratio2]=biterr(ant6, newmsg2);
ber2(i) = ratio2/msg_size*10;

msg_size=msg_size*10;

%disp ([‘The Bit Error Rate Is’ ,num2str (ratio)];

end

[errBit ratBit] = biterr(code7, code_3, log2(M));

[number, ratio2] = biterr (ant7, newmsg3, log2 (M));

pack = 3;

BNRpbit=[5:9:25];

for i=1:pack

[number,ratio3]=biterr(ant7, newmsg3);

ber3(i) = ratio3/msg_size*10;

msg_size=msg_size*10;

%disp ([‘The Bit Error Rate Is’ ,num2str (ratio)];

end

figure (10);

snr = 0:1:15;

n = 0.5;

M=4; % number of symbol

k = log2 (M);

Ebno = snr-10*log10(k) + 10*log10(n);

bit = berawgn (Ebno, ‘psk’, M, ‘diff’ );

k= 13;

N= (2^M) – 1;

berub = barcoding (Ebno, ‘RS’ , ‘hard’, N, K);


%Plotting BER vs SNR

semilogy(snr, bit, ‘r’);

hold on;

semilogy(snr, berub, ‘g’);

grid on;

legend (‘Signal Without ICI’, ‘Signal With ICI’);

xlabel (‘SNR’);

ylabel (‘BER’);

hold on;

title (‘Performance with ICI and Without ICI’);

Figure 4
Discussion:

1. Discuss the OFDM Parameters Standard and MIMO Capacity.


2. Explain the type of modulator and demodulator used in order to produce better system in
wireless signal transmission.
3. Present the Expected Output from the system. (Example shown in Figure 5)

Figure 5

4. Produce MIMO-OFDM Standards and Applications embedded with the latest technology for
receiver system model.

Conclusion.

Derive from the objectives of the lab work.

References:

Books (APA format)

You might also like