matlab prototype

25
Cooperative Relaying Matlab Prototype Report Green Group, 2008-04-29 Abstract The Matlab prototype in our project includes two parts: First, the Matlab simulation of the three-node communication system including Source, Relay, and Destination nodes. We simulate three different types of relaying protocols (Amplify-and-forward, Decode-and- forward, Detect-and-forward) and then provide the comparison and analysis of the results. Second, the data transmission from one instance of Matlab running on one node to another instance of Matlab running on another node through the Rayleigh fading channel on DSP board(a SISO system). We then provide the BER performance of this SISO system. 1

Upload: hakankaya85

Post on 27-Nov-2014

130 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Matlab Prototype

Cooperative Relaying

Matlab Prototype Report

Green Group, 2008-04-29

Abstract

The Matlab prototype in our project includes two parts: First, the Matlab simulation of the three-node communication system including Source, Relay, and Destination nodes. We simulate three different types of relaying protocols (Amplify-and-forward, Decode-and-forward, Detect-and-forward) and then provide the comparison and analysis of the results. Second, the data transmission from one instance of Matlab running on one node to another instance of Matlab running on another node through the Rayleigh fading channel on DSP board(a SISO system). We then provide the BER performance of this SISO system.

1 SISO system

Figure 1 SISO system

The SISO system is the basic idea of this project. It consists of a bit source, transmitter, channel, receiver, and a bit sink. The bit source generates a stream of information bits to be transmitted by the transmitter. Typically, we employ a random bit generator as a bit source in simulations. The transmitter encodes the bits into coded bits by using the channel encoder and then appends the guard bits and training

1

Page 2: Matlab Prototype

bits at the beginning of the coded bits and converts these bits into symbols and applies pulse shaping in order to have the proper bandwidth of transmitted signal before transmitting through the band-limited channel. At this point we have the frame of information. The transmitter also up-converts the information frame into the pass band signal and then feed through a channel, which is a Rayleigh fading channel with limited bandwidth. The receiver block will do processing frame-by-frame; first takes the output from the channel, estimates timing and channel coefficients, demodulates the received symbols into bits, and decode these bits into the information bits which are fed to the bit sink. In our simulation, the bit sink simply counts the number of errors that occurred to gather statistics used for investigating the performance of the system (Bit error probability).The following parts will provide the details and algorithms that we have used to simulate the system in our project.

1.1 Transmitter

Figure 2 Transmitter

The transmitter basically contains blocks of processing units that work together to transmit the information bits in the appropriate form corresponding to the channel characteristics. The details of each block are provided in the following.

1.1.1 Channel EncoderWe use 1/2 rate convolution channel coding and use Viterbi algorithm for decoding at the receiver.

Figure 3 1/2 rate Convolution Channel Encoding

2

Page 3: Matlab Prototype

1.1.2 Training sequenceIn the system, training sequences are used for synchronization, channel estimation, and SNR estimation at the receiver. The correlation properties of the training sequence are important as they affect the estimation accuracy. Ideally, the autocorrelation function for the training sequence should equal a delta pulse. In this project, a Maximum-length shift-register sequence (M-sequence) of length 32 bits is used and the autocorrelation is shown in Figure 4.

0 10 20 30 40 50 60 70-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

Figure 4 Autocorrelation of the training sequence

1.1.3 Guard bitsThe guard bits are used to provide tolerance of error due to the frame synchronization. We simply use bit-1 of length 12 for this guard bits.

1.1.4 Frame structureIn the project, we use 256 information bits with 12 guard bits and 32 Training bits sequence in the beginning of every frame.A packet consists of 40 frames and a pilot sequence of length 128 is also added for packet synchronization in the beginning. In order to compensate the delay and the transient effect of real channel, 1000 zeros and 2328 zeros are added in the beginning and end, respectively (according to experiment).

3

Page 4: Matlab Prototype

Figure 5 Frame structure

1.1.5 Modulation (Symbol mapping)QPSK modulator with Gray mapping for the data is used in our system. For the inverse mapping from symbols to bits, we use hard decision. The constellation of QPSK with Gray mapping is shown in Figure 6.

Figure 6 Constellation of QPSK

1.1.6 Upsampling

Figure 7 Upsampling

We simulate the upsampled system by using upsampling factor Q =8 to provide an ease and accuracy in processing at the receiver. This upsampling is done by inserting 7 zeros between every symbol.

1.1.7 Pulse shapingA (truncated) root raised cosine pulse is used in our system because it has much improved spectral properties than a rectangular pulse shape. The root raised cosine pulse (with roll-off factor= 0.22) used in our system is shown in Figure 8.

4

Page 5: Matlab Prototype

0 10 20 30 40 50 60 70 80 90-0.1

-0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

Figure 8 Root raised cosine pulse (with roll-off factor= 0.22)

-25 -20 -15 -10 -5 0 5 10 15 20 250

0.5

1

1.5

2

2.5

3

f/KHz

Figure 9 Root raised cosine pulse in frequency domain

And after pulse shaping, the signal is limited within the bandwidth of the real channel 9.6Khz.(See Figure 10). We can also calculate the approximated bandwidth of the transmitted signal as follows

5

Page 6: Matlab Prototype

-25 -20 -15 -10 -5 0 5 10 15 20 250

200

400

600

800

1000

1200

1400

f (KHz)

The baseband transmitted signal

Figure 10 Transmitted signals in baseband

1.1.8 Up-conversion

Figure 11 Up-conversion

Up-conversion is used to move the baseband signals to passband. The carrier frequency is set to be 10 KHz in our system which can fulfill the requirement of the real channel on board.

6

Page 7: Matlab Prototype

-25 -20 -15 -10 -5 0 5 10 15 20 250

500

1000

1500

2000

2500

3000

f (KHz)

The passband transmitted signal

Figure 12 Transmitted signals in passband

1.2 Channel

Figure 13 Simulated complex channel

The channel is simulated in baseband (a+jb) to be a Rayleigh flat fading channel with Doppler frequency shift 0.5 Hz by using Jake’s model.

1.3 Receiver

1.1.1 SynchronizationSince there is a delay of the channel on board, synchronization is implemented in order to find the start point of the signal sequence. The synchronization algorithm used here is based on the complex training sequence. By cross-correlating the received complex-valued samples with a locally generated time-shifted replica of the training sequence, we can find the first sampling time from the position of the maximum points.

7

Page 8: Matlab Prototype

1.1.2 Down-conversion

Figure 14 Down-conversion

The signals are down converted to baseband after synchronization.

1.1.3 Channel estimationChannel estimation is based on Least-square criteria. c = qpsk(b_train);

r_tr = r(1: length(c));

a_hat = r_tr *c'*inv(c*c');

The estimated channel coefficients and original channel coefficients are shown in Figure 15.

0 1 2 3 4 5 6 7 8 9 10

x 104

0.4

0.5

0.6

0.7

0.8

0.9

1

1.1

1.2

1.3

Estimated channel coefficients

Original channel coefficients

Figure 15 Channel coefficients

1.1.4 DetectionThree kinds of detectors can be used at receiver: ZF (Zero Forcing), MMSE

8

Page 9: Matlab Prototype

(Minimum Mean Square Error) and ML (Maximum Likelihood).

2 Relay system

The whole system includes a source, a relay, a destination and three independent Rayleigh fading channels.

Figure 16 Relay system

It is a half duplex, orthogonal system. In the first timeslot, signals are transmitted from the source to both relay and destination. Relay does some pocessing to the recieived signal, then in the second timeslot, they are transimitted to destination.

(a) First timeslot

(b) Second timeslotFigure 17 Relay system

9

Page 10: Matlab Prototype

2.1 Relay

2.1.1 Amplify-and-forwardIn this case, the relay amplifies and transmits the received signal. To remain within its

power constraint, we can derive that the amplifier gain is depend on the fading

channel coefficients :

where P is the power of transmit signal and is the power of the noise from

channel.

2.1.2 Decode-and-forwardIn this case, we decode the received signals at relay and transmit the fresh codeword using the same code to destination.As mentioned in section 1, three kinds of detectors can be used here: ZF (Zero Forcing), MMSE (Minimum Mean Square Error) and ML (Maximum Likelihood).

2.1.3 Detect-and-forwardThe relay transmits the detected symbol.

2.1.4 Combining At destination, we use different methods of combining for different relay prototypes.

A. Improved Maximum Ratio Combining (MRC)This method is used in amplify-and-forward relay. The destination combines the received signals using MRC, where the diversity combining coefficients for the twobranches can be shown as,

B. Maximum Ratio Combining (MRC)In the decode-and-forward, MRC is used for combining. The signal after combining is

where and are the estimated channel coefficients of channel between relay

and destination, source and destination. and are received signals from relay

10

Page 11: Matlab Prototype

and source, respectively.

C. Optimal Combining for detect-and-forwardWe derive combining methods for detect-and-forward relaying based on linear MMSE and ML criteria.a. Linear MMSEThe received signals at the destination from the source and the relay are:

We set the signal after combining to be . So

We can get

Similarly,

b. ML

We also got the motivation from “Receiver Design for Wireless Relay Channels with

Regenerative Relays, Majid Nasiri Khormuji and Erik G. Larsson” to use an optimal detector in order to obtain the improved performance. The optimal detector will search for the symbol such that it maximizes the posterior probabilities defined as

,

11

Page 12: Matlab Prototype

which we abbreviate as .

By using Bayes’ rule, the posterior probabilities may be expressed as

where is the conditional PDF of

the received signal given , and is the a priori probability of the mth symbol

being transmitted. After some simplification, the criterion turns to be the maximum-likelihood (ML) criterion with as the likelihood function.

Further we derive this function in terms of the received signals from source and relay as the following

We define

,

So we have

where is the average symbol error

probability at the relay and .

2.2 Chanel model

Three independent Rayleigh fading channels with Additive White Gaussian Noise (AWGN) are exploited in the system model for channel simulation. The Doppler shift is 0.5 Hz for all the channels.

12

Page 13: Matlab Prototype

3 Relay Simulation in Matlab

3.1 Constellation

The constellations for different relay protocols are plot in Figure 18 (SNR=5dB).

-2 -1 0 1 2-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

Qua

drat

ure

In-Phase

Scatter plot

-2 -1 0 1 2-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

Qua

drat

ure

In-Phase

Scatter plot

(a)Amplify-and-forward (b)Decode-and-forward,

-2 -1 0 1 2-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

Qua

drat

ure

In-Phase

Scatter plot

-2 -1 0 1 2-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

Qua

drat

ure

In-Phase

Scatter plot

(c)Detect-and-forward (b)One linkFigure 18 Constellations for different relay protocols

3.2 BER comparison

The BER of different relay protocols are plotted in Figure 19.

13

Page 14: Matlab Prototype

2 4 6 8 10 12 14 16 18 20 2210

-5

10-4

10-3

10-2

10-1

100

SNR(dB)

BE

R

Amplify

Decode

Detect

No Relay

Figure 19 BER comparison

From the result, we can see that the relay system performs better than the SISO system in this simulation. This result agrees with the fact that the relay system can gain the advantage of spatial diversity of 2 when the channel between source and destination and channel between relay and destination are uncorrelated. To provide the comparison of BER performance among three different relaying protocols, the channel characteristics in the system and combining algorithms are the major factors.

It is not obvious to provide the exact comparison that which relaying protocol performs better than the others. However, in this simulation we use one set of channel characteristics and obtain the result such that the Amplify-and-forward protocol performs the best. This can be explained that in the simulation we use MRC combing and the link between source and relay is not too bad in the sense of noise level so the MRC combining here is optimal for the Amplify-and-forward. In the simulation we also apply the MRC combining for the other two relaying protocols and obtain worse results than the Amplify-and-forward. One of the reasons is that the MRC is not optimal for these two protocols since there can be errors occurred in the decoded (or detected) bits. This can be improved by applying the optimal detector for Detect-and-forward protocol which will be done in the project later on.

In addition the result shows that the Decoded-and-forward protocol performs better than the Detect-and-forward protocol. The reason for this could be the benefit of the coding system for the communication through fading channel.

14

Page 15: Matlab Prototype

4 SISO Simulation on DSP Board

We simulate the SISO system using the channel enumerated on DSP board. The system works in the way that the receiver always keeps listening to the incoming signal and measure the variance of it. The receiver will check if the incoming signal’s variance is larger than the noise variance threshold. And when the signal is transmitted at the transmitter, the receiver can detect it and start do processing later on.

4.1 Synchronization

To start do processing on the received signal, we need to synchronize the packet we received to find the starting point of the data packet. Here we use the known pilot sequence at receiver to do correlation with the received signal in order to obtain the starting point of packet. The plot of received signal and correlation between received signal and pilot sequence is shown below.

0 1 2 3 4 5 6

x 104

-150

-100

-50

0

50

100

150

X: 2.283e+004Y: -5

Figure 20 The received signal

15

Page 16: Matlab Prototype

2 2.1 2.2 2.3 2.4 2.5 2.6 2.7

x 104

0

500

1000

1500

2000

2500

3000

3500

4000

X= 22838Y= 3763.4924

Figure 21 Correlation between received signal and pilot sequence

4.2 BER

-10 -8 -6 -4 -2 0 2 4 6 8 1010

-2

10-1

100

Eb/No(SNR)

BE

R in

log

scal

e

Figure 22 The BER performance versus estimated SNR for SISO system

16

Page 17: Matlab Prototype

We obtain the BER performance of the SISO system which is reasonable for the Rayleigh flat fading channel. Here we plot the BER versus the estimated SNR so it is not obvious to compare the result with the theoretical one.

17