+ All Categories
Home > Documents > Digital Communication Lab

Digital Communication Lab

Date post: 26-Feb-2023
Category:
Upload: mnit
View: 0 times
Download: 0 times
Share this document with a friend
83
1 Lab Tasks/Assignments ADC Lab Submitted to: Submitted by: Mrs.Garima Saini Gaurav Soni Assistant Professor M.E.-Modular-ECE ECE 2011 Batch
Transcript

1

Lab Tasks/Assignments

ADC Lab

Submitted to: Submitted by:

Mrs.Garima Saini Gaurav Soni

Assistant Professor M.E.-Modular-ECE

ECE 2011 Batch

2

INDEX

S.No. Name of Experiment Page No.

1 To understand the basics of MATLAB. 3

2 To plot sine and cosine waveform using MATLAB code. 35

3 To generate delayed sine waveforms using MATLAB. 38

4 To perform modulation and demodulation of BPSK and draw its scatter plot . 43

5 To perform the following:1. Scattered plot of QPSK for different noise level2. Calculate number of errors and symbol error rate of the signal at differentnoise level.

45

6 To plot a QPSK signal with different delay using for loop. 57

7 To plot a PSK signal with different delay using for loop. 59

8 To Generate constant envelope PSK signal waveform for M=8,fc=6/T. 64

9 To perform simulation of various modulation techniques using SIMULINK. 76

3

EXPERIMENT-1

Aim: To understand the basics of MATLAB.

Exercise-1

>> p=[14678]

p =

14678

>> q=[1;2;5;1;6;]

q =

1

2

5

1

6

>> r=p*q

r =

4

14678

29356

73390

14678

88068

>> s=q*p

s =

14678

29356

73390

14678

88068

>> t=p.*q

t =

14678

29356

73390

14678

88068

5

>> p=[1 4 6 7 8]

p =

1 4 6 7 8

>> q=[1; 2; 5; 1; 6;]

q =

1

2

5

1

6

>> s=q*p

s =

1 4 6 7 8

2 8 12 14 16

5 20 30 35 40

1 4 6 7 8

6 24 36 42 48

6

>> t=p.*q

??? Error using ==> times

Matrix dimensions must agree.

>> t=p*q

t =

94

>> t=q*p

t =

1 4 6 7 8

2 8 12 14 16

5 20 30 35 40

1 4 6 7 8

6 24 36 42 48

Exercise-2

>> p-q

??? Error using ==> minus

Matrix dimensions must agree.

7

>> p=[14678]

p =

14678

>> q=[1;2;5;1;6;;]

q =

1

2

5

1

6

>> t=p.*q

t =

14678

29356

73390

14678

88068

8

>> p-q

ans =

14677

14676

14673

14677

14672

>> p+q

ans =

14679

14680

14683

14679

14684

>> p-t

ans =

0

9

-14678

-58712

0

-73390

>> p+t

ans =

29356

44034

88068

29356

102746

>> p^2

ans =

215443684

>> p.^2

ans =

215443684

10

Exercise-3

>> p=[14678]

p =

14678

>> sqrt(p)

ans =

121.1528

>> a=[1 3 5; 2 1 7; 9 0 2;]

a =

1 3 5

2 1 7

9 0 2

>> a(2,3)

11

ans =

7

>> a(2:3;1:2)

??? a(2:3;1:2)

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> a=(2:2,1:3)

??? a=(2:2,1:3)

|

Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

>> a(2:3,1:3)

ans =

2 1 7

9 0 2

>> a(2:3,1:2)

ans =

12

2 1

9 0

>> a(:,2)=[]

a =

1 5

2 7

9 2

>> a(2:3,1:2)

ans =

2 7

9 2

>> a(:,2)

ans =

5

7

2

13

Exercise-4

>> zeros(2,3)

ans =

0 0 0

0 0 0

>> ones(2,3)

ans =

1 1 1

1 1 1

>> eye(3)

ans =

1 0 0

0 1 0

0 0 1

>> fix([-2.33 2.66])

14

ans =

-2 2

>> floor([-2.33 2.66])

ans =

-3 2

>> ceil([-2.33 2.66])

ans =

-2 3

>> ceil([-2.66 2.33])

ans =

-2 3

>> round([-2.33 2.66])

ans =

15

-2 3

>> round([-2.66 2.33])

ans =

-3 2

>> m=0.5;

>> c=-2;

>> x=[0,1.5,3,4,5,7,9,10];

>> y=m*x+c;

>> y=m*x+c

y =

-2.0000 -1.2500 -0.5000 0 0.5000 1.5000 2.5000 3.0000

Exercise-5

>> a=[1 3 5;2 1 7;9 0 2;]

a =

1 3 5

16

2 1 7

9 0 2

>> a*3

ans =

3 9 15

6 3 21

27 0 6

>> a(2,2)

ans =

1

>> linspace(2,10,5)

ans =

2 4 6 8 10

>> x=linspace(0,2*pi,9)

x =

17

0 0.7854 1.5708 2.3562 3.1416 3.9270 4.7124 5.4978 6.2832

>> linspace(0,10,2)

ans =

0 10

>> linspace(0,10,5)

ans =

0 2.5000 5.0000 7.5000 10.0000

>> linspace(0,10,6)

ans =

0 2 4 6 8 10

>> linspace(4,10,7)

ans =

4 5 6 7 8 9 10

18

Exercise-6

>> a=[1;2;3;4;]

a =

1

2

3

4

>> b=[5 6 7 8]

b =

5 6 7 8

>> a*b

ans =

5 6 7 8

10 12 14 16

15 18 21 24

20 24 28 32

19

>> b*a

ans =

70

>> a.*b

??? Error using ==> times

Matrix dimensions must agree.

>> b.*a

??? Error using ==> times

Matrix dimensions must agree.

>> a^2

??? Error using ==> mpower

Matrix must be square.

>> a.^2

ans =

1

4

9

16

20

>> b^2

??? Error using ==> mpower

Matrix must be square.

>> b.^2

ans =

25 36 49 64

Exercise-7

>> linspace(10,-10,9)

ans =

10.0000 7.5000 5.0000 2.5000 0 -2.5000 -5.0000 -7.5000 -10.0000

>> linspace(25,45,5)

ans =

25 30 35 40 45

21

Exercise 8

t=linspace(1,10,10)

t =

1 2 3 4 5 6 7 8 9 10

>> sin(t)

ans =

Columns 1 through 9

0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.2794 0.6570 0.9894 0.4121

Column 10

-0.5440

>> x=t*sin(t)

??? Error using ==> mtimes

Inner matrix dimensions must agree.

22

>> a=sin(t)

a =

Columns 1 through 9

0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.2794 0.6570 0.9894 0.4121

Column 10

-0.5440

>> x=t.*a

x =

Columns 1 through 9

0.8415 1.8186 0.4234 -3.0272 -4.7946 -1.6765 4.5989 7.9149 3.7091

Column 10

-5.4402

23

>> x=t.*sin(t)

x =

Columns 1 through 9

0.8415 1.8186 0.4234 -3.0272 -4.7946 -1.6765 4.5989 7.9149 3.7091

Column 10

-5.4402

>> y=(t-1)/(t+1)

y =

0.7426

>> y=(t-1)./(t+1)

y =

Columns 1 through 9

0 0.3333 0.5000 0.6000 0.6667 0.7143 0.7500 0.7778 0.8000

24

Column 10

0.8182

>> t^2

??? Error using ==> mpower

Matrix must be square.

>> t.^2

ans =

1 4 9 16 25 36 49 64 81 100

>> z=sin.(t^2)

??? Error using ==> mpower

Matrix must be square.

>> z=sin(t.^2)

z =

Columns 1 through 9

0.8415 -0.7568 0.4121 -0.2879 -0.1324 -0.9918 -0.9538 0.9200 -0.6299

Column 10

25

-0.5064

>> z=sin(t.*t)

z =

Columns 1 through 9

0.8415 -0.7568 0.4121 -0.2879 -0.1324 -0.9918 -0.9538 0.9200 -0.6299

Column 10

-0.5064

>> z=.sin(t.^2)

??? z=.sin(t.^2)

|

Error: Unexpected MATLAB operator.

>> z=sin.(t.^2)

??? Argument to dynamic structure reference must evaluate to a valid field name

>> z=sin(t.^2)./t.^2

26

z =

Columns 1 through 9

0.8415 -0.1892 0.0458 -0.0180 -0.0053 -0.0275 -0.0195 0.0144 -0.0078

Column 10

-0.0051

Exercise 9

To plot sine waveform

x=linspace(0,2*pi,100);

>> y=sin(x);

>> plot(x,y)

>> title('plot created by gaurav')

0 1 2 3 4 5 6 7-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1plot c reated by gaurav

27

>> exp(3)

ans =

20.0855

>> exp(1)

ans =

2.7183

>> log(exp(3))

ans =

3

>> log(exp(3))/log(10)

ans =

1.3029

>> log10(exp(3))

28

ans =

1.3029

>> exp(pi*sqrt(163))

ans =

2.6254e+017

>> sin(pi/6)

ans =

0.5000

>> cos(pi/6)

ans =

0.8660

>> tan(pi/2)

ans =

29

1.6331e+016

>> x=32*pi;

>> y=cosh^2(x)-sinh^2(x)

??? y=cosh^2(x)-sinh^2(x)

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> y=cosh^2x-sinh^2x

??? y=cosh^2x-sinh^2x

|

Error: Unexpected MATLAB expression.

>> y=cosh(x)*cosh(x)-sinh(x)*sinh(x)

y =

0

>> y=(coshx)^2-(sinhx)^2

??? Undefined function or variable 'coshx'.

>> y=cosh(x)^2-sinh(x)^2

30

y =

0

>> x=linspace(0,4*pi,10);

>> y=exp(-0.4*x).*sin(x)

y =

Columns 1 through 9

0 0.5634 0.1119 -0.1621 -0.0688 0.0394 0.0304 -0.0069 -0.0113

Column 10

-0.0000

To plot exp(-0.4*x).*sin(x) for different no. of samples

>> x=linspace(0,4*pi,10);

>> y=exp(-0.4*x).*sin(x);

>> plot(x,y)

31

>> x=linspace(0,4*pi,50);

>> y=exp(-0.4*x).*sin(x);

>> plot(x,y)

0 2 4 6 8 10 12 14-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

32

>> x=linspace(0,4*pi,100);

>> y=exp(-0.4*x).*sin(x);

>> plot(x,y)

0 2 4 6 8 10 12 14-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

0 2 4 6 8 10 12 14-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

33

>> a=0:10:100

a =

0 10 20 30 40 50 60 70 80 90 100

>> a=[1,2;3,4]

a =

1 2

3 4

>> nthroot(a,3)

ans =

1.0000 1.2599

1.4422 1.5874

>> a=[8]

a =

8

34

>> nthroot(a,3)

ans =

2

>> a=[1,2;3,4]

a =

1 2

3 4

>> asqrt=sqrt(a)

asqrt =

1.0000 1.4142

1.7321 2.0000

35

EXPERIMENT-2

Aim: To plot sine and cosine waveform using MATLAB code.

Code:

t=0:pi/100:2*pi;

>> a=1;

>> y=a*sin(t);

>> xlabel('time axis')

>> ylabel('a')

>> plot(t,y)

>> grid on;

0 1 2 3 4 5 6 7-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time axis

a

36

For a=10

>> t=0:pi/100:2*pi;

>> a=10;

>> y=a*sin(t);

>> xlabel('time axis')

>> ylabel('a')

>> plot(t,y)

>> grid on;

To draw cosine waveform

>> t=0:pi/100:2*pi;

>> a=10;

0 1 2 3 4 5 6 7-10

-8

-6

-4

-2

0

2

4

6

8

10

37

>> y=a*cos(t);

>> xlabel('time axis')

>> ylabel('a')

>> plot(t,y)

>> grid on;

0 1 2 3 4 5 6 7-10

-8

-6

-4

-2

0

2

4

6

8

10

38

EXPERIMENT-3

Aim: To generate delayed sine waveforms using MATLAB.

Code:

>> t=0:pi/100:2*pi;

>> a=1;

>> y=a*sin(t);

>> y1=a*sin(t-0.25);

>> y1=a*sin(t-0.5);

>> y1=a*sin(t-0.25);

>> y2=a*sin(t-0.5);

>> y3=a*sin(t+0.25);

>> y4=a*sin(t+0.5);

>> plot(t,y,t,y1,t,y2,t,y3,t,y4);

>> grid on;

>> xlabel('time');

>> ylabel('amplitude');

39

Add On:

Delayed sine waves with different amplitudes

>> t=0:pi/100:2*pi;

>> a1=1;

>> a2=3;

>> a3=6;

>> a4=10;

>> y1=a1*sin(t-0.25);

>> y2=a2*sin(t-0.5);

>> y3=a3*sin(t+0.25);

0 1 2 3 4 5 6 7-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

time

ampl

itude

delayed sine waves

40

>> y4=a4*sin(t+0.5);

>> plot(t,y,t,y1,t,y2,t,y3,t,y4);

>> grid on;

0 1 2 3 4 5 6 7-10

-8

-6

-4

-2

0

2

4

6

8

10delayed sine waves with different amplitudes

time

ampl

itude

41

>> h = legend('y1','y2','y3','y4');

>> t=0:pi/100:2*pi;

>> a1=1;

>> a2=3;

>> a3=6;

>> y1=a1*sin(t-0.25);

>> y2=a2*sin(t-0.45);

>> y3=a3*sin(t+0.25);

>> plot(t,y1,'-ro',t,y2,'-.b',t,y3,'-g*');

>> title('delayed sine waves with different amplitudes-creatde by gaurav');

0 1 2 3 4 5 6 7-10

-8

-6

-4

-2

0

2

4

6

8

10delayed sine waves with different amplitudes

time

ampl

itude

y1y2y3y4

42

>> xlabel('time');

>> ylabel('amplitude');

>> h = legend('y1','y2','y3');

>> grid on;

0 1 2 3 4 5 6 7-6

-4

-2

0

2

4

6delayed sine waves with different amplitudes-creatde by gaurav

time

ampl

itude

y1y2y3

43

EXPERIMENT-4

Aim: To perform modulation and demodulation of BPSK and draw its scatter plot .

Code:

(For M=2)

>> M=2;

>> y=[0:M-1];

>> y1=pskmod(y,M);

>> scatterplot(y1);

(For M=4)

-1 -0 . 5 0 0 . 5 1

-1

-0 . 8

-0 . 6

-0 . 4

-0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

Qu

ad

ratu

re

In -P h a s e

S c a t t e r p lo t

-1 -0 .5 0 0 .5 1

-1

-0 .8

-0 .6

-0 .4

-0 .2

0

0 .2

0 .4

0 .6

0 .8

1

Qu

ad

ratu

re

In -P has e

S c at te r p lo t

44

For M=8

For M=16

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Qua

drat

ure

In-Phase

Scatter plot

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Qua

drat

ure

In-Phase

Scatter plot

45

EXPERIMENT-5

Aim: To perform the following:

a) Scattered plot of QPSK for different noise levelb) Calculate number of errors and symbol error rate of the signal at different noise level.

Code:

For SNR=1

>> M=4;

>> x=randint(1000,1,M);

>> y1=pskmod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,1);

>> scatterplot(y2);

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Qua

drat

ure

In-P has e

S c atter plot

46

>> y3=pskdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

253

errrate =

0.2530

-3 -2 -1 0 1 2 3-3

-2

-1

0

1

2

3Q

uadr

atur

e

In-Phase

Scatter plot

47

For SNR=5

>> y3=pskdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

75

errrate =

0.0750

-2 -1 0 1 2-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

Qua

drat

ure

In-Phase

Scatter plot

48

For SNR=20

>> y3=pskdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

0

errrate =

0

-1 -0.5 0 0.5 1

-1

-0.5

0

0.5

1

Qua

drat

ure

In-Phase

Scatter plot

49

Add on:

>> M=4;

>> x=randint(100,1,M);

>> y1=pskmod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=pskdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

1

errrate =

0.0100

>> M=8;

>> x=randint(100,1,M);

>> y1=pskmod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=pskdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

50

32

errrate =

0.3200

>> M=16;

>> x=randint(100,1,M);

>> y1=pskmod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=pskdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

66

errrate =

0.6600

>> M=32;

>> x=randint(100,1,M);

>> y1=pskmod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=pskdemod(y2,M);

51

>> [numerr,errrate]=symerr(x,y3)

numerr =

83

errrate =

0.8300

Important deduction: As M increases in PSK ,error also increases

Comparison with QAM (or QASK) Scheme

>> M=4;

>> x=randint(100,1,M);

>> y1=qammod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=qamdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

1

errrate =

0.0100

52

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

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

53

>> M=8;

>> x=randint(100,1,M);

>> y1=qammod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=qamdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

0

errrate =

0

-3 -2 -1 0 1 2 3

-3

-2

-1

0

1

2

3

Qua

drat

ure

In-Phase

Scatter plot

54

>> M=16;

>> x=randint(100,1,M);

>> y1=qammod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=qamdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

3

errrate =

0.0300

-4 -2 0 2 4-4

-3

-2

-1

0

1

2

3

4Q

uadr

atur

e

In-Phase

Scatter plot

55

>> M=32;

>> x=randint(100,1,M);

>> y1=qammod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=qamdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

4

errrate =

0.0400

>> M=64;

>> x=randint(100,1,M);

>> y1=qammod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=qamdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

1

56

errrate =

0.0100

>> M=128;

>> x=randint(100,1,M);

>> y1=qammod(x,M);

>> scatterplot(y1);

>> y2=awgn(y1,5);

>> scatterplot(y2);

>> y3=qamdemod(y2,M);

>> [numerr,errrate]=symerr(x,y3)

numerr =

0

errrate =

0

Important deduction: As M increases in QAM ,error decreases

57

EXPERIMENT-6

Aim: To plot a QPSK signal with different delay using for loop.

Code:

>> Es=50;

>> T=10;

>> fc=6/T;

>> t=(0:pi/1000:2*pi);

>> M=4;

>> for m=0:3

y=sqrt(2*Es/T)*cos(2*pi*fc*t+2*pi*m/M);

subplot(2,2,m+1);

plot(y);

title('qpsk with different delay using for loop');

xlabel('time');

ylabel('amplitude');

end

58

0 1000 2000 3000-4

-2

0

2

4qpsk with different delay using for loop

time

ampl

itude

0 1000 2000 3000-4

-2

0

2

4qpsk with different delay using for loop

time

ampl

itude

0 1000 2000 3000-4

-2

0

2

4qpsk with different delay using for loop

time

ampl

itude

0 1000 2000 3000-4

-2

0

2

4qpsk with different delay using for loop

time

ampl

itude

59

EXPERIMENT-7

Aim: To plot a PSK signal with different delay using for loop.

Code:

>> Es=50;

>> T=10;

>> fc=6/T;

>> t=(0:pi/1000:2*pi);

>> M=2;

>> for m=0:1

y=sqrt(2*Es/T)*cos(2*pi*fc*t+2*pi*m/M);

subplot(2,1,m+1);

plot(y);

end

60

Add On:

Aim: To plot a PSK signal with different delay and SNR=5 using for loop

>> Es=50;

>> T=10;

>> fc=6/T;

>> t=(0:pi/1000:2*pi);

>> M=2;

>> for m=0:1

y=sqrt(2*Es/T)*cos(2*pi*fc*t+2*pi*m/M);

y1=awgn(y,5);

xlabel('time');

ylabel('amplitude');

subplot(2,1,m+1);

0 500 1000 1500 2000 2500-4

-2

0

2

4psk with different delay using for loop

time

ampl

itude

0 500 1000 1500 2000 2500-4

-2

0

2

4psk with different delay using for loop

time

ampl

itude

61

plot(y1);

end

Aim: To plot PSK with different SNR

>> Es=50;

>> T=10;

>> fc=6/T;

>> t=(0:pi/1000:2*pi);

>> M=2;

>> for m=1

y=sqrt(2*Es/T)*cos(2*pi*fc*t+2*pi*m/M);

y1=awgn(y,5);

0 500 1000 1500 2000 2500-5

-4

-3

-2

-1

0

1

2

3

4

5

time

ampl

itude

psk with SNR=5 and different delay

0 500 1000 1500 2000 2500-5

-4

-3

-2

-1

0

1

2

3

4

5

time

ampl

itude

psk with SNR=5 and different delay

62

y2=awgn(y,10);

y3=awgn(y,1);

y4=awgn(y,100);

subplot(4,1,1);

plot(y1);

xlabel('time');

ylabel('amplitude');

title('psk with SNR=5 and different delay-creatde by gaurav');

subplot(4,1,2);

plot(y2);

xlabel('time');

ylabel('amplitude');

title('psk with SNR=10 and different delay-creatde by gaurav');

subplot(4,1,3);

plot(y3);

xlabel('time');

ylabel('amplitude');

title('psk with SNR=1 and different delay-created by gaurav');

subplot(4,1,4);

plot(y4);

xlabel('time');

ylabel('amplitude');

title('psk with SNR=100 and different delay-created by gaurav');

end;

63

0 500 1000 1500 2000 2500-10

-5

0

5

time

ampl

itude

psk with SNR=5 and different delay-creatde by gaurav

0 500 1000 1500 2000 2500-5

0

5

time

ampl

itude

psk with SNR=10 and different delay-creatde by gaurav

0 500 1000 1500 2000 2500-10

-5

0

5

10

time

ampl

itude

psk with SNR=1 and different delay-created by gaurav

0 500 1000 1500 2000 2500-4

-2

0

2

4

time

ampl

itude

psk with SNR=100 and different delay-created by gaurav

64

EXPERIMENT-8

Aim: To Generate constant envelope PSK signal waveform for M=8,fc=6/T.

Code:

>> echo on;

>> T=1;

>> M=8;

>> Es=T/2;

>> fc=6/T;

>> N=100;

>> delta_T=T/(N-1);

>> t=0:delta_T:T;

>> u0=sqrt(2*Es/T)*cos(2*pi*fc*t);

>> u1=sqrt(2*Es/T)*cos(2*pi*fc*t+2*pi/M);

>> u2=sqrt(2*Es/T)*cos(2*pi*fc*t+4*pi/M);

>> u3=sqrt(2*Es/T)*cos(2*pi*fc*t+6*pi/M);

>> u4=sqrt(2*Es/T)*cos(2*pi*fc*t+8*pi/M);

>> u5=sqrt(2*Es/T)*cos(2*pi*fc*t+10*pi/M);

>> u6=sqrt(2*Es/T)*cos(2*pi*fc*t+12*pi/M);

>> u7=sqrt(2*Es/T)*cos(2*pi*fc*t+14*pi/M);

>> subplot(8,1,1);

>> title('psk waveforms-created by gaurav');

>> plot(t,u0);

>> subplot(8,1,2);

>> plot(t,u1);

65

>> subplot(8,1,3);

>> plot(t,u2);

>> subplot(8,1,4);

>> plot(t,u3);

>> subplot(8,1,5);

>> plot(t,u4);

>> subplot(8,1,6);

>> plot(t,u5);

>> subplot(8,1,7);

>> plot(t,u6);

>> subplot(8,1,8);

>> plot(t,u7);

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1psk waveforms-created by gaurav

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

0

1

66

Assignment

1.Write a program for FSK

2.Scatter plot of FSK for different noise level

3.Calculate no. of errors and symbol error rate of the signal

>> M=2;

>> x=randint(100,1,M);

>> y1=fskmod(x,M,8,8,32);

>> scatterplot(y1);

>> y2=awgn(y1,5,'measured');

>> scatterplot(y2);

>> y3=fskdemod(y2,M,8,8,32);

>> [numerr,errrate]=symerr(x,y3)

numerr =

0

errrate =

0

67

>> M=4;

>> x=randint(100,1,M);

-1 -0 .5 0 0 .5 1

-1

-0 .8

-0 .6

-0 .4

-0 .2

0

0 .2

0 .4

0 .6

0 .8

1Q

ua

dra

ture

In -P has e

S c at te r p lo t

-2 -1 0 1 2-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

Qua

drat

ure

In-Phase

Scatter plot

68

>> y1=fskmod(x,M,8,8,32);

>> scatterplot(y1);

>> y2=awgn(y1,5,'measured');

>> scatterplot(y2);

>> y3=fskdemod(y2,M,8,8,32);

>> [numerr,errrate]=symerr(x,y3)

numerr =

0

errrate =

0

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Qua

drat

ure

In-P has e

S c atter p lot

69

>> M=2;

>> x=randint(100,1,M);

>> y1=fskmod(x,M,16,16,32);

>> y1=fskmod(x,M,8,8,32);

>> scatterplot(y1);

>> y2=awgn(y1,25,'measured');

>> scatterplot(y2);

>> y3=fskdemod(y2,M,8,8,32);

>> [numerr,errrate]=symerr(x,y3)

numerr =

-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

70

0

errrate =

0

>> M=2;

>> x=randint(100,1,M);

>> y1=fskmod(x,M,8,8,32);

>> scatterplot(y1);

>> y2=awgn(y1,10,'measured');

>> scatterplot(y2);

-1 -0.5 0 0.5 1

-1

-0.5

0

0.5

1

Qua

drat

ure

In-Phase

Scatter plot

71

>> y3=fskdemod(y2,M,8,8,32);

>> [numerr,errrate]=symerr(x,y3)

numerr =

0

errrate =

0

>> M=2;

>> x=randint(100,1,M);

>> y1=fskmod(x,M,8,8,32);

>> scatterplot(y1);

-1.5 -1 -0.5 0 0.5 1 1.5

-1.5

-1

-0.5

0

0.5

1

1.5

Qua

drat

ure

In-Phase

Scatter plot

72

>> y2=awgn(y1,1,'measured');

>> scatterplot(y2);

>> y3=fskdemod(y2,M,8,8,32);

>> [numerr,errrate]=symerr(x,y3)

numerr =

2

errrate =

0.0200

-2 -1 0 1 2

-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

Qua

drat

ure

In-Phase

Scatter plot

73

>> M=2;

>> y1=fskmod(x,M,16,16,32);

>> scatterplot(y1);

>> y2=awgn(y1,10,'measured');

>> scatterplot(y2);

>> y3=fskdemod(y2,M,16,16,32);

>> [numerr,errrate]=symerr(x,y3)

numerr =

0

errrate =

0

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Qua

drat

ure

In-Phase

Scatter plot

74

>> M=4;

>> y1=fskmod(x,M,16,16,256);

>> scatterplot(y1);

>> y2=awgn(y1,10,'measured');

>> scatterplot(y2);

>> y3=fskdemod(y2,M,16,16,256);

>> [numerr,errrate]=symerr(x,y3)

numerr =

-1.5 -1 -0.5 0 0.5 1 1.5

-1.5

-1

-0.5

0

0.5

1

1.5

Qua

drat

ure

In-Phase

Scatter plot

75

0

errrate =

0

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Qua

drat

ure

In -P has e

S c atter p lot

-1.5 -1 -0.5 0 0.5 1 1.5

-1.5

-1

-0.5

0

0.5

1

1.5

Qua

drat

ure

In-Phase

Scatter plot

76

EXPERIMENT -9

Aim: To perform simulation of various modulation techniques using SIMULINK.

Simulink Exercises

1. Simulation of FSK Modulation and Demodulation and calculation of error rate.

Modified model:

77

Scope output:

Add on:

with probability of error 0.5, sample time 1,initial speed 61

M-FSKModulatorBaseband

8-FSK

M-FSKDemodulator

Baseband

8-FSK

Error RateCalculation

Error Rate Calculation

Tx

Rx

Display

0.7536

7537

1e+004Bernoulli Binary

Generator

BernoulliBinary

AWGNChannel

AWGN

78

with probability of error 5,sample time 1/100, initial speed 61

with probability of error 0.5, sample time 1/1000,initial speed 25

2. DBPSK Modulation and Demodulation and error rate calculation

M-FSKModulatorBaseband

8-FSK

M-FSKDemodulator

Baseband

8-FSK

Error RateCalculation

Error Rate Calculation

Tx

Rx

Display

0.7513

432

575Bernoulli Binary

Generator

BernoulliBinary

AWGNChannel

AWGN

M-FSKModulatorBaseband

8-FSK

M-FSKDemodulator

Baseband

8-FSK

Error RateCalculation

Error Rate Calculation

Tx

Rx

Display

0.7697

859

1116Bernoulli Binary

Generator

BernoulliBinary

AWGNChannel

AWGN

79

80

3. MSK Modulation and Demodulation and error rate calculation

81

82

4. QPSK Modulation and Demodulation and error rate calculation

83


Recommended