0% found this document useful (0 votes)
40 views83 pages

Digital Communication Lab

The document contains instructions for laboratory tasks and assignments related to an ADC lab. It includes 9 experiments covering topics like understanding MATLAB basics, plotting sine and cosine waveforms, generating delayed sine waves, performing modulation and demodulation of BPSK, QPSK signals, generating constant envelope PSK signals, and performing simulations of various modulation techniques using SIMULINK. Each experiment contains detailed code examples and output to demonstrate the concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views83 pages

Digital Communication Lab

The document contains instructions for laboratory tasks and assignments related to an ADC lab. It includes 9 experiments covering topics like understanding MATLAB basics, plotting sine and cosine waveforms, generating delayed sine waves, performing modulation and demodulation of BPSK, QPSK signals, generating constant envelope PSK signals, and performing simulations of various modulation techniques using SIMULINK. Each experiment contains detailed code examples and output to demonstrate the concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

Lab Tasks/Assignments

ADC Lab

Submitted to: Submitted by:

Mrs.Garima Saini Gaurav Soni

Assistant Professor M.E.-Modular-ECE

ECE 2011 Batch

1
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: 45


1. Scattered plot of QPSK for different noise level
2. Calculate number of errors and symbol error rate of the signal at different
noise level.

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

2
EXPERIMENT-1

Aim: To understand the basics of MATLAB.

Exercise-1

>> p=[14678]

p=

14678

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

q=

>> r=p*q

r=

3
14678

29356

73390

14678

88068

>> s=q*p

s=

14678

29356

73390

14678

88068

>> t=p.*q

t=

14678

29356

73390

14678

88068

4
>> p=[1 4 6 7 8]

p=

1 4 6 7 8

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

q=

>> 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

5
>> 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.

6
>> p=[14678]

p=

14678

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

q=

>> t=p.*q

t=

14678

29356

73390

14678

88068

7
>> p-q

ans =

14677

14676

14673

14677

14672

>> p+q

ans =

14679

14680

14683

14679

14684

>> p-t

ans =

8
-14678

-58712

-73390

>> p+t

ans =

29356

44034

88068

29356

102746

>> p^2

ans =

215443684

>> p.^2

ans =

215443684

9
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)

10
ans =

>> 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 =

11
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 =

12
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])

13
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 =

14
-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

15
2 1 7

9 0 2

>> a*3

ans =

3 9 15

6 3 21

27 0 6

>> a(2,2)

ans =

>> linspace(2,10,5)

ans =

2 4 6 8 10

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

x=

16
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

17
Exercise-6

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

a=

>> 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

18
>> 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 =

16

19
>> 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

20
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.

21
>> 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

22
>> 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

23
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

24
-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

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

plot c reated by gaurav


1

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 1 2 3 4 5 6 7

26
>> exp(3)

ans =

20.0855

>> exp(1)

ans =

2.7183

>> log(exp(3))

ans =

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

ans =

1.3029

>> log10(exp(3))

27
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 =

28
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=

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

??? Undefined function or variable 'coshx'.

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

29
y=

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

30
0.6

0.5

0.4

0.3

0.2

0.1

-0.1

-0.2
0 2 4 6 8 10 12 14

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

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

>> plot(x,y)

31
0.6

0.5

0.4

0.3

0.2

0.1

-0.1

-0.2
0 2 4 6 8 10 12 14

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

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

>> plot(x,y)

0.6

0.5

0.4

0.3

0.2

0.1

-0.1

-0.2
0 2 4 6 8 10 12 14

32
>> 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=

33
>> nthroot(a,3)

ans =

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

a=

1 2

3 4

>> asqrt=sqrt(a)

asqrt =

1.0000 1.4142

1.7321 2.0000

34
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.8

0.6

0.4

0.2

0
a

-0.2

-0.4

-0.6

-0.8

-1
0 1 2 3 4 5 6 7
time axis

35
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;

10

-2

-4

-6

-8

-10
0 1 2 3 4 5 6 7

To draw cosine waveform

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

>> a=10;

36
>> y=a*cos(t);

>> xlabel('time axis')

>> ylabel('a')

>> plot(t,y)

>> grid on;

10

-2

-4

-6

-8

-10
0 1 2 3 4 5 6 7

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

38
delayed sine waves
1

0.8

0.6

0.4

0.2
amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 1 2 3 4 5 6 7
time

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

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

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

>> grid on;

delayed sine waves with different amplitudes


10

2
amplitude

-2

-4

-6

-8

-10
0 1 2 3 4 5 6 7
time

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

delayed sine waves with different amplitudes


10
y1
y2
y3
8 y4

2
amplitude

-2

-4

-6

-8

-10
0 1 2 3 4 5 6 7
time

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

41
>> xlabel('time');

>> ylabel('amplitude');

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

>> grid on;

delayed sine waves with different amplitudes-creatde by gaurav


6
y1
y2
y3

2
amplitude

-2

-4

-6
0 1 2 3 4 5 6 7
time

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

S c a t t e r p lo t

0.8

0.6

0.4
Q u a d ra t u re

0.2

-0 . 2

-0 . 4

-0 . 6

-0 . 8

-1
-1 -0 . 5 0 0.5 1
In -P h a s e

(For M=4)

S c a t t e r p lo t
1

0.8

0.6

0.4

0.2
Q u a d ra t u re

-0 . 2

-0 . 4

-0 . 6

-0 . 8

-1
-1 -0 . 5 0 0.5 1
In -P h a s e

43
For M=8

S c atter plot
1

0.8

0.6

0.4

0.2
Q uadrature

-0.2

-0.4

-0.6

-0.8

-1
-1 -0.5 0 0.5 1
In-P has e

For M=16

Scatter plot

0.8

0.6

0.4

0.2
Quadrature

-0.2

-0.4

-0.6

-0.8

-1
-1 -0.5 0 0.5 1
In-Phase

44
EXPERIMENT-5

Aim: To perform the following:

a) Scattered plot of QPSK for different noise level


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

S c atter plot
1

0.8

0.6

0.4

0.2
Q uadrature

-0.2

-0.4

-0.6

-0.8

-1
-1 -0.5 0 0.5 1
In-P has e

45
Scatter plot
3

1
Quadrature

-1

-2

-3
-3 -2 -1 0 1 2 3
In-Phase

>> y3=pskdemod(y2,M);

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

numerr =

253

errrate =

0.2530

46
For SNR=5

Scatter plot
2.5

1.5

0.5
Quadrature

-0.5

-1

-1.5

-2

-2.5
-2 -1 0 1 2
In-Phase

>> y3=pskdemod(y2,M);

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

numerr =

75

errrate =

0.0750

47
For SNR=20

Scatter plot

0.5
Quadrature

-0.5

-1

-1 -0.5 0 0.5 1
In-Phase

>> y3=pskdemod(y2,M);

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

numerr =

errrate =

48
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 =

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 =

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

50
>> [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 =

errrate =

0.0100

51
Scatter plot
1

0.8

0.6

0.4

0.2
Quadrature

-0.2

-0.4

-0.6

-0.8

-1
-1 -0.5 0 0.5 1
In-Phase

Scatter plot

1.5

0.5
Quadrature

-0.5

-1

-1.5

-2

-2 -1 0 1 2
In-Phase

52
>> 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 =

errrate =

Scatter plot
3

1
Quadrature

-1

-2

-3
-3 -2 -1 0 1 2 3
In-Phase

53
Scatter plot
4

1
Quadrature

-1

-2

-3

-4
-4 -2 0 2 4
In-Phase

>> 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 =

errrate =

0.0300

54
>> 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 =

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 =

55
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 =

errrate =

Important deduction: As M increases in QAM ,error decreases

56
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

57
qpsk with different delay using for loop qpsk with different delay using for loop
4 4

2 2
amplitude

amplitude
0 0

-2 -2

-4 -4
0 1000 2000 3000 0 1000 2000 3000
time time
qpsk with different delay using for loop qpsk with different delay using for loop
4 4

2 2
amplitude

0 amplitude 0

-2 -2

-4 -4
0 1000 2000 3000 0 1000 2000 3000
time time

58
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

59
psk with different delay using for loop
4

2
amplitude

-2

-4
0 500 1000 1500 2000 2500
time
psk with different delay using for loop
4

2
amplitude

-2

-4
0 500 1000 1500 2000 2500
time

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

60
plot(y1);

end

psk with SNR=5 and different delay


5

1
amplitude

-1

-2

-3

-4

-5
0 500 1000 1500 2000 2500
time

psk with SNR=5 and different delay


5

1
amplitude

-1

-2

-3

-4

-5
0 500 1000 1500 2000 2500
time

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

61
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;

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

amplitude
-5

-10
0 500 1000 1500 2000 2500
time
psk with SNR=10 and different delay-creatde by gaurav
5
amplitude

-5
0 500 1000 1500 2000 2500
time
psk with SNR=1 and different delay-created by gaurav
10

5
amplitude

-5

-10
0 500 1000 1500 2000 2500
time
psk with SNR=100 and different delay-created by gaurav
4

2
amplitude

-2

-4
0 500 1000 1500 2000 2500
time

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

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

psk waveforms-created by gaurav


1

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

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

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

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

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

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

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

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

65
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 =

errrate =

66
S c a t t e r p lo t

0.8

0.6

0.4

0.2
Q u a d ra t u re

-0 . 2

-0 . 4

-0 . 6

-0 . 8

-1
-1 -0 . 5 0 0.5 1
In -P h a s e

Scatter plot
2.5

1.5

0.5
Quadrature

-0.5

-1

-1.5

-2

-2.5
-2 -1 0 1 2
In-Phase

>> M=4;

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

67
>> 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 =

errrate =

S c a tte r p lo t
1

0 .8

0 .6

0 .4

0 .2
Q u a d ra tu re

-0 .2

-0 .4

-0 .6

-0 .8

-1
-1 -0 .5 0 0 .5 1
In -P h a s e

68
Scatter plot

1.5

0.5
Quadrature

-0.5

-1

-1.5

-2
-2 -1 0 1 2
In-Phase

>> 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 =

69
0

errrate =

Scatter plot

0.5
Quadrature

-0.5

-1

-1 -0.5 0 0.5 1
In-Phase

>> M=2;

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

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

>> scatterplot(y1);

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

>> scatterplot(y2);

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

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

numerr =

errrate =

Scatter plot

1.5

0.5
Quadrature

-0.5

-1

-1.5

-1.5 -1 -0.5 0 0.5 1 1.5


In-Phase

>> M=2;

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

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

>> scatterplot(y1);

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

>> scatterplot(y2);

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

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

numerr =

errrate =

0.0200

Scatter plot

2.5

1.5

0.5
Quadrature

-0.5

-1

-1.5

-2

-2.5

-2 -1 0 1 2
In-Phase

72
>> 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 =

errrate =

Scatter plot
1

0.8

0.6

0.4

0.2
Quadrature

-0.2

-0.4

-0.6

-0.8

-1
-1 -0.5 0 0.5 1
In-Phase

73
Scatter plot

1.5

0.5
Quadrature

-0.5

-1

-1.5

-1.5 -1 -0.5 0 0.5 1 1.5


In-Phase

>> 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 =

74
0

errrate =

S c a tte r p lo t

0 .8

0 .6

0 .4

0 .2
Q u a d ra tu re

-0 .2

-0 .4

-0 .6

-0 .8

-1
-1 -0 .5 0 0 .5 1
In -P h a s e

S c atter plot

1.5

0.5
Q uadrature

-0.5

-1

-1.5

-1.5 -1 -0.5 0 0.5 1 1.5


In-P has e

75
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:

76
Scope output:

Add on:

Tx
8-FSK AWGN Error Rate 0.7536
Bernoulli 8-FSK
Calculation
Binary Rx 7537
M-FSK M-FSK
AWGN Error Rate
Bernoulli Binary
1e+004
Generator Modulator Demodulator Calculation
Channel
Baseband Baseband

Display

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

77
Tx
8-FSK AWGN Error Rate 0.7513
Bernoulli 8-FSK
Calculation
Binary Rx 432
M-FSK M-FSK
AWGN Error Rate
Bernoulli Binary
575
Generator Modulator Demodulator Calculation
Channel
Baseband Baseband

Display

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

Tx
8-FSK AWGN Error Rate 0.7697
Bernoulli 8-FSK
Calculation
Binary Rx 859
M-FSK M-FSK
AWGN Error Rate
Bernoulli Binary
1116
Generator Modulator Demodulator Calculation
Channel
Baseband Baseband

Display

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

2. DBPSK Modulation and Demodulation and error rate calculation

78
79
3. MSK Modulation and Demodulation and error rate calculation

80
81
4. QPSK Modulation and Demodulation and error rate calculation

82
83

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy