A Simple Communication System Design Lab #2 with MATLAB Simulink

Post on 16-Mar-2018

333 views 15 download

Transcript of A Simple Communication System Design Lab #2 with MATLAB Simulink

- 1/40 -

Instructor : Jaewook KangAt CSNL-GISTE-mail: jwkkang@gist.ac.kr2011, Mar. 25th

A Simple Communication System Design Lab with MATLAB Simulink- Lab #2: - How to use S-function bulider

- Concept of upsampling and downsampling- PSF implementation

- 2/40 -

SchedulesSchedules

Place: IC203

Weeks Time Hour Instructor

1 weekLab. #0 3.11

(13:00~16:00)

3- Overview of Development with Simulink

- QPSK Model with AWGN Channel/ Rayleigh FadingChannel

- Development Example: Interference Cancellation for Satellite CommuniJunil Ahn

2 weeksLab. #1

3.18(13:00~14:20)

1.5 - Basic OFDM Junil Ahn

3.18(14:30~16:00)

1.5- Introduction - How to use Simulink with interleaver

implementationJaewook Kang

3 weeksLab. #2

3.25(13:00~16:00)

3- How to use S-function builder- PSF and Matched filter design- Concept of upsampling and downsampling

Jaewook Kang

4 weeksLab. #3

4.1(13:00~16:00)

3 - Phase splitter - Up conversion and down conversion Jaewook Kang

5 weeksLab. #4

4.8(13:00~16:00)

3 - How to make subsystem Jaewook Kang

- 3/40 -

Today’s main pointsToday’s main pointsKnow how to use S-function builder

Learn about what PSF is

Implement PSF with up/down-sampling using simulink.

- 4/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

Why do we employ interleaver ? Error usually occurs in burst manner. Conventionally, channel coder is designed against a random and independent error. Interleaver is introduced to scatter the burst or packetized data in a time domain. Deinterleaved data show almost random and independent errors. Channel Decoder can handle such error.

Two type of interleanverBlock interleaver:

Simple concept, easy to implement. Needs more memory, and cause a large latency

Convolutional interleaver:Require half memory of block interleaver, causing a small memory. Most communication system employs this for its attractive features.

- 5/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

Why do we employ interleaver ? Error usually occurs in burst manner. Conventionally, channel coder is designed against a random and independent error. Interleaver is introduced to scatter the burst or packetized data in a time domain. Deinterleaved data show almost random and independent errors. Channel Decoder can handle such error.

Two type of interleanverBlock interleaver:

Simple concept, easy to implement. Needs more memory, and cause a large latency

Convolutional interleaver:Require half memory of block interleaver, causing a small memory. Most communication system employs this for its attractive features.

- 6/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

Example of convolutional Interleaver/Deinterleaver operation

Block0 0 2 5 0 0 0 18 7 6 5 4 3 2 1… …

10 10

10

- 7/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

Specification of Conv.-interleaver

The Number of row : RInterleaver length: LThe latency through inter and de-interleaver:The required memory for each block :

L=2R=4

< Interleaver side > < De-interleaver side >

2( )R R L− ×2( )

2R R L− ×

- 8/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

Testbench using simulink blocksEx) R=4, L=1 Latency: 2(4 4) 1 12− × =

Latnecy:12

- 9/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

S-function builder blockLet’s make R=4, L=1 convolutional interleaver.The size of the required buffer: 2( ) (16 4) 2 6

2 2R R L− × − ×

= =

The Size of the memory And the initial condition

- 10/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

S-function builder blockDate properties

R

L

- 11/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

S-function builder blockOutput – specify what the current output data is in C language

- 12/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

S-function builder blockDiscrete Update – Describe operation for memory inside the block, such as buffer shift at each time instance.Array wrt. the memory denoted by xD[]

- 13/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

Simulation Check your block using interleaving block given by MATLAB simulink.

- 14/40 -

Lab #1: Convolutional interleaver block implementationLab #1: Convolutional interleaver block implementation

What about de-interleaver block ? Implementation of de-inleaver block is assignment of this week.I’ll provide the code at next lecture.It’s very similar with conv-inverleaver block. Make it by yourself !!!Does it work correctly ? Check by yourself like the below figure.

- 15/40 -

Our target systemOur target systemTx part

Rx part

Tx Source Interleaver QAMMapper PSF X

NCO

↑4

PhaseSplitter

Matchedfilter

QAMDemapperX

NCO

↓4 De-Interleaver Rx Source

:Real:Complex

- 16/40 -

Up/Down-samplingUp/Down-samplingResampling of Discrete signal

Basically,

Now, we re-sample the signal with L=2

, :The discrete randian frequency (rad/sample).d dw wπ≥

( ) cos( )dx n w n=

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0

2

4

6

8

10

12

14

16

rad < pi >

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20

1

2

3

4

5

6

7

8

rad < pi >

Q) Why 16 ?

- 17/40 -

Up/Down-samplingUp/Down-samplingResampling of Discrete signal

With L=4

With L=8

( ) cos( )dx n w n=

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0

1

2

3

4

5

6

7

8

rad < pi >

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0

1

2

3

4

5

6

7

8

rad < pi >

Looks like D-waveformrather than D-sequence !!

- 18/40 -

Up/Down-samplingUp/Down-samplingResampling of Discrete signal

The resampling represented like below

How to implement the resampling process

( ) cos( )dx n w n=

_

( ) cos( )

Let n= , :

( ) cos( ) cos( )

d

d d up

x n w nm L resampling factorL

mx m w w mL

=

= =

Sample upL LPF

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n

0 5 10 15 20 25 30 35-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n 0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n

( )x n( )upx m ( )rex m

Q) What about freq. response of xup(m) ?

- 19/40 -

Up/Down-samplingUp/Down-samplingUp-sampling

Padding L-1 zeros between two adjacent symbols

Down-samplingDecimating samples between two adjacent symbol time.

Sample upL

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n0 5 10 15 20 25 30 35

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n

( )x n ( )upx m

Sample downD

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n

( )rex m ( )x n

0 5 10 15-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time index n

- 20/40 -

Pulse shaping filterPulse shaping filterWhy PSF?Reason I: Channel Bandwidth is limited !!

From Fourier’s theorem, bandwidth of discrete signal is from –infto inf.

x(n) in time domain X(m) frequency domain

- 21/40 -

Pulse shaping filterPulse shaping filterWhy PSF?Reason I: Channel Bandwidth is limited !!

Since the given channel is bandlimited, we cannot transmit such discrete signals appropriately.

We should reshape the bandwidth of the signals while preserving the information.

Consider rectangular shaped bandwidth first.

The BW of the original discrete signal

The limited rectangular BW IFT

The bandlimited signal in time domain

- 22/40 -

Pulse shaping filterPulse shaping filterWhy PSF?Reason I: Channel Bandwidth is limited !!

Rectangular in freq. domain sinc. function in time domain. The range of sinc. function is .

Multiplication in freq. domain is convolution in time domain such that the PSF signal is

The BW of the original discrete signal

The limited rectangular BWIFT

The bandlimited signal in time domain

t−∞ < < ∞

( ) ( ) ( ) ( ) ( ( ))PSFk

x nT x nT h nT h kT x T n k= ∗ = −∑

- 23/40 -

Pulse shaping filterPulse shaping filterWhy PSF?Reason I: Channel Bandwidth is limited !!

PSF transforms discrete sequences to discrete waveforms with limited bandwidth.PSF cut out frequency components to make the input sequncescompact.

- 24/40 -

Pulse shaping filterPulse shaping filterWhy PSF?Reason II: PSF mitigates ISI effect.

Why ISI?Since tail of sinc. function of previous symbols coincides with the current symbol, such a fact can corrupt the current symbols info. when symbol timing is not matched.

- 25/40 -

Pulse shaping filterPulse shaping filterWhy PSF?Reason II: PSF mitigates ISI effect.

The signal have ISI due to timing mismatched The signal with perfectly timing matched

- 26/40 -

Pulse shaping filterPulse shaping filterWhy PSF?Reason II: PSF mitigates ISI effect.

Well-designed PSFs effectively mitigate the ISI effect according to roll-off factor.

Smaller amplitude of the tail mitigates ISI effect with higher rolloff-factor.

However, it require wider bandwidth.

- 27/40 -

Pulse shaping filterPulse shaping filterHow to design PSF

Step I: system setup Rsym=1 sym/sec Tsym= 1 sec

Step II: Upsampling

Step III: Nyquist bandwidth constraint

Step IV: Determine number of tap for PSF. (Odd tap)Tapnum = 2*(Numof zero-crossing in the half side )* L+1The longer tail, the shaper filter.Tapnum=65 with L=4 and Numof zero-crossing in the half side =8

_( / sec) / , 4

( / )1/ 4

sym up symsampleR R L let L

L sample sym= = =

×=

_12 (1 ) ( ) 02 4sym upW r R rad with rππ≥ × + = =

_ 4sym upT =

- 28/40 -

Pulse shaping filterPulse shaping filterHow to design PSF

Draw the sinc function using rcosine function with ‘sqrt’ in MATLABNote that the sinc. Function is squared root raise cosine function.Consider symbol energy to be normalized to 1 after PSF

-40 -30 -20 -10 0 10 20 30 40-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Time index n

h(n)

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20

0.5

1

1.5

2

2.5

3

3.5

4

4.5

X= 0.24615Y= 2.4698

w (pi) rad

|H(w

)|

- 29/40 -

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20

0.2

0.4

0.6

0.8

1

1.2

1.4

w (pi) rad

|H(w

)|

Pulse shaping filterPulse shaping filterMatched filter

Use the same filter as PSF without scaleDivide the filter coefficient by L to keep the symbol energy 1.

-40 -30 -20 -10 0 10 20 30 40-0.1

-0.05

0

0.05

0.1

0.15

0.2

0.25

Time index n

h(n)

- 30/40 -

Pulse shaping filterPulse shaping filter%--------------------------------------------------------------------------% This m-file is to generate raised cosine for Pulse Shaping filter% 11.3.24 kang jae wook%--------------------------------------------------------------% r : roll-off factor of this filter % L : up-Sampling rate of input signal (sample/sym)% DESIGNTYPE : you can select 'normal' that makes normal raised..% cosine filter.% tol: The number of zero-crossing point in the half side.%--------------------------------------------------------------------------% b=rcosine(1,L,'TYPE'.rolloff,tol)% Tap = [2 * tol * L] + 1%------------------------------------------------------------------% L:4 sample/sym% Tapnum :65% roll off :0.5% --squared root raised cosine filter%------------------------------------------------L=4;r=0;tol=8;Tap=2 * tol * fs_up+1b=rcosine(1,fs_up,'sqrt',r,tol)*2.0;%c=rcosine(1,4,'normal',0,3);n=-(Tap-1)/2:(Tap-1)/2

figure (3);stem(n,b);xlabel('Time index n','fontsize',12);ylabel('h(n)','fontsize',12);w=0:2/Tap:2-2/Tap;

a=abs(fft(b));figure (4);stem(w,a);xlabel('w (pi) rad','fontsize',12);ylabel('|H(w)| ','fontsize',12);

- 31/40 -

Symbol energy EsymSymbol energy Esym

Tx partCan you indicate energy of symbol at each point of the Tx block diagram ?

Tx Source Interleaver QAMMapper PSF X

NCO

↑4

:Real:Complex

- 32/40 -

Our target systemOur target systemRx part

What about the receiver side ?

PhaseSplitter

Matchedfilter

QAMDemapperX

NCO

↓4 De-Interleaver Rx Source

:Real:Complex

- 33/40 -

PSF and MAT with SimulinkPSF and MAT with SimulinkPSF implementation using FIR filter

Add up/down-sampling blockImplement PSF and MAT filter using FIR filter block pair.Make ctrl – m file with previously given codes.

- 34/40 -

PSF and MAT with SimulinkPSF and MAT with SimulinkTx side

Rx side

upsampling PSF

After MAT filter

Down-sampling

- 35/40 -

PSF and MAT with SimulinkPSF and MAT with SimulinkPSF, MAT filter using FIR filter via S-function builder

- 36/40 -

PSF and MAT with SimulinkPSF and MAT with SimulinkPSF with S-function

Initialization and Data properties

You must put 65 zeros

Generate rcosine coeff. Using m-file

- 37/40 -

PSF and MAT with SimulinkPSF and MAT with SimulinkPSF with S-function

C-codes for outputIn this place, just put code with respect to the current output.

- 38/40 -

PSF and MAT with SimulinkPSF and MAT with SimulinkPSF with S-function

C-codes for update inner-bufferDynamic operation, such as buffer shift, should be described here.

- 39/40 -

PSF and MAT with SimulinkPSF and MAT with SimulinkPSF with S-function

Implement PSF and Matched filterDoes it properly work like given figures ?

Calculate delay properly to evaluate BER. You should consider inter de/lnterleaver delay as well as PSF and MAT delay.

Check symbol energy at all points.Think why the symbol energy have changed like that

- 40/40 -

Next time…Next time…

Place: IC203

Weeks Time Hour Instructor

1 weekLab. #0 3.11

(13:00~16:00)

3- Overview of Development with Simulink

- QPSK Model with AWGN Channel/ Rayleigh FadingChannel

- Development Example: Interference Cancellation for Satellite CommuniJunil Ahn

2 weeksLab. #1

3.18(13:00~14:20)

1.5 - Basic OFDM Junil Ahn

3.18(14:30~16:00)

1.5- Introduction - How to use Simulink with interleaver

implementationJaewook Kang

3 weeksLab. #2

3.25(13:00~16:00)

3- How to use S-function builder- PSF and Matched filter design- Concept of upsampling and downsampling

Jaewook Kang

4 weeksLab. #3

4.1(13:00~16:00)

3 - Phase splitter - Up conversion and down conversion Jaewook Kang

5 weeksLab. #4

4.8(13:00~16:00)

3 - How to make subsystem- Channel implementation using Jaewook Kang