Sunteți pe pagina 1din 76

Scilab Code for Optical Fiber Communication by Gerd Keiser 1

Created by Prof. R. Senthilkumar Institute of Road and Transport Technology rsenthil signalprocess@in.com

Cross-Checked by Prof. Saravanan Vijayakumaran, IIT Bombay sarva@ee.iitb.ac.in

11 January 2011

1 Funded by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Text Book Companion and Scilab codes written in it can be downloaded from the website www.scilab.in

Book Details

Authors: G. Keiser Title: Optical Fiber Communication Publisher: Tata McGrawHill Edition: 4th Edition, 8th Reprint Year: 2010 Place: New Delhi ISBN: 0-07-064810-7

Scilab numbering policy used in this document and the relation to the above book.

Exa Example (Solved example)

Fig Code for Figure(Scilab code that is used for plotting the respective figure of the above book )

For example, Exa 4.56 means solve example 4.56 of the above book.

2

Contents

List of Scilab Codes

4

1 First chapter

2

2 Second chapter

7

3 Third chapter

11

4 Fourth chapter

16

5 Fifth chapter

22

6 Sixth chapter

26

7 Seventh chapter

31

8 Eight chapter

35

9 Ninth chapter

40

10 Tenth chapter

46

11 Eleventh chapter

54

12 Twelve chapter

59

13 Thirteen chapter

64

14 Fourteen chapter

68

3

List of Scilab Codes

Exa 1.1

Exa 1.2

Exa 1.4

Program to calculate time period and phase shift

.

.

Example 1.2

. Shannon Channel Capacity formula

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

2

3

3

Exa 1.5

. Capacity of a channel using Shannon’s formula

.

.

.

.

4

Exa 1.6

Program to calculate attenuation loss of power

5

Exa 1.7

Power gain calculation for a signal travelling from one

point to another point

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

5

Exa 2.1

. Critical Angle of incidence

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

7

Exa 2.2

Finding Critical angle, numerical aperture, acceptance

angle

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

7

Exa 2.3

Program to Calculate NORMALIZED FREQUENCY

’V’ and Numerical Aperture

.

.

.

.

.

.

.

.

.

.

.

.

.

8

Exa 2.4

Power flow in the core and cladding of step index fiber

8

Exa 2.5

Program to calculate Fiber Birefringence Beta f

.

.

.

9

Exa 3.1

Exa 3.2

. To calculate input and output power in dBm

Program to Find Attenuation in dB/km

.

.

.

.

.

.

.

.

11

11

Exa 3.3

Rayleigh scattering loss

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

12

Exa 3.4

Program to calculate percent in decrease of number of

modes .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

12

Exa 3.5

. Calculation of pulse broadening

13

Exa 3.6

Calculation of bandwidth distance

14

Exa 3.7

Program to Find out the Material Dispersion

14

Exa 3.8

Program to Find out Waveguide Dispersion

15

Exa 4.1

Program to find intrinsic carrier concentration

.

.

.

.

16

Exa 4.3

.

.

.

.

.

.

.

.

.

.

16

Exa 4.4

Exa 4.5

Finding Enegy gap and Wavelength Finding Enegy gap and Wavelength

. To find out the Internal Quantum Efficiency and Inter-

.

.

.

.

.

.

.

.

.

17

nal Power level of LED source

.

.

.

.

.

.

.

.

.

.

.

.

17

4

Exa 4.6

Exa 4.7

External Quantum Efficiency in percentage

18

Program to find Lasing Threshold gain

19

Exa 4.8

Program TO Calculate Frequency Spacing and Wave-

length Spacing

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

19

Exa 4.9

Calculation of number of half-wavelengths and wave-

Exa 5.1

Exa 5.2

length spacing between lasing modes

. Calculation of Lateral power distribution coefficient

.

.

.

.

.

.

.

.

.

.

20

22

Program to Calculate Optical Power Emitted from the

Exa 5.3

Light source and Optical power coupled to step-index

.

fiber .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

22

Fresnel reflection, power coupled and power loss

23

Exa 5.4

Exa 5.5

Power coupled between two graded index fibers

24

Loss between single mode fibers due to Lateral mis-

alignment .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

24

Exa 5.6

Exa 6.1

Exa 6.2

Exa 6.3

Exa 6.4

Exa 6.5

Exa 6.6

Exa 6.7

Exa 7.1

Loss between single mode fibers due to angular mis-

alignment .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

25

Cut-off wavelength of photodiode

26

Calculation of Quantum efficiency

26

Calculation of photocurrent

27

Calculation of Responsivity of photodiode

27

To find primary photocurrent and multiplication factor

28

Mean-square shot noise current, Mean-square dark cur-

rent and Mean-Square thermal noise current

29

Circuit bandwidth of a photodiode

30

To find optimum decision threshold

31

Exa 7.2

Exa 7.3

To find out signal-to-noise ratio and probability of error

for given ’Q’

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

31

Plotting Bit Error Rate versus Q factor

33

Exa 7.4

Exa 8.1

Exa 8.2

Exa 8.3

Exa 8.4

Exa 8.5

Exa 8.6

Exa 8.7

Exa 8.8

To find the energy of the photon incident on photodiode

and Minimum incident optical power

.

.

.

.

.

.

.

.

34

Program to calculate the Total Optical Power loss

35

Program to calculate the system margin

35

Program to calculate link rise time

36

Program to calculate link rise time

36

Calculation of Number of bits affected by a burst error

37

Program to find coefficients of generator polynomial .

37

Program to find CRC(Cyclic Redundancy Check)

38

Program to percentage of burst error detected by CRC

39

5

Exa 8.9

Exa 9.1

Percent overhead to the information stream Using Reed-

Solomon code for error correction

.

.

.

.

.

.

.

.

.

.

39

Program to find Relative Intensity Noise (RIN)

40

Exa 9.2

Exa 10.1

Exa 10.2

Exa 10.3

Exa 10.5

Exa 10.6

Program to Find limiting conditions for pin-photodiode

loss, Return loss of 2x2 Fiber coupler

.

.

.

.

.

.

.

.

40

Finding the center wavelength

46

Finding mean frequency spacing

46

Program to find coupling ratio, Excess loss, Insertion

47

Finding output powers at output port of 2x2 coupler

48

Program to find waveguide length

48

Exa 10.7

Exa 10.8

Exa 10.9

Program to find Excess loss, Splitting loss and total loss

49

Program to Waveguide Length difference

49

Fiber Bragg Grating: Peak Reflectivity, Coupling coef-

ficient, full-bandwidth

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

50

Exa 10.10

Phased-Array-Based-Devices: Channel spacing in terms

of wavelength and path-length difference

.

.

.

.

.

.

51

Exa 10.11

Phased-Array-Based Devices: Length difference between

adjacent array waveguides

.

.

.

.

.

.

.

.

.

.

.

.

.

.

52

Exa 10.12

Exa 11.1

Exa 11.2

Maximum number of channels that can be placed in

the tuning range

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

53

Program to calculate Photon density

54

Pumping rate and zero-signal gain

54

Exa 11.3

Exa 11.6

Maximum input power and maximum output power .

55

Optical Signal-to-noise ratio (OSNR)

56

Exa 11.7

Pump power of EDFA

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

56

Exa 11.8

OSNR for different ASE noise level

57

Exa 11.9

Exa 11.10

. Upper bound on input optical signal power

Noise penalty factor

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

57

58

Exa 12.1

Exa 12.2

Effective length of fiber

. Calculation of Stimulated Brillouin Scattering (SBS)

.

.

.

.

.

.

.

.

.

.

.

.

.

.

threshold power

59

59

Exa 12.3

.

.

.

.

.

.

.

.

.

.

.

. Four-wave mixing-calculation of power generated due

.

.

.

.

.

.

.

.

.

Exa 12.4

to the interaction of signals at different frequencies Full-width Half-Maximum (FWHM) soliton pulse nor-

malized time

60

61

Exa 12.5

Exa 12.6

.

.

.

.

.

.

.

.

.

.

.

.

. Calculation of normalized distance parameter for dis-

.

.

.

.

.

.

.

.

.

.

persion shifted fiber

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

61

Program to calculate soliton peak power

62

6

Exa 12.7 FWHM soliton pulse width and fraction of bit slot oc-

Exa 13.1

cupied by a soliton

. Calculation of power budget for optical link

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

62

64

Exa 13.2

Calculation of Number stations for given loss

 

.

.

.

65

Exa 13.3

Calculation of worst case Dynamic Range

 

66

Exa 13.4

Calculation of power margin between transmitter and

receiver for Star architectures

.

.

.

.

.

.

.

.

.

.

.

.

.

.

66

Exa 13.5

Determination of maximum length of multimode fiber

link

.

. Fig 14.10 Performance Measurement and Monitoring for sce

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

67

68

1

Chapter 1 First chapter

Scilab code Exa 1.1 Program to calculate time period and phase shift

1

// Caption : Program s h i f t

to

c a l c u l a t e

time

period

 

and

phase

2

// Example1 . 1

 

3

// Page

8

4

clear ;

5

clc ;

 

6

close ;

 

7

f1

=

10^5;

//

f 1

= 100KHz

 

8

f2

=

10^9;

//

f 2

= 1GHz

9

T1

=

1/ f1 ;

 

10

T2

=

1/ f2 ;

11

phi

=

(1/4) *360;

 

12

phi_rad

 

=

phi /57.3;

 

13

disp ( T1 , ’ Time

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

=

 

100

KHZ ’ )

 

14

disp ( T2 , ’ Time GHZ ’ )

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

=

1

15

disp ( phi ,

’ p ha s e

s

h i f t

d e g r e e s ’ ) ;

i n

r a d i a n s ’ ) ;

 

16

disp ( phi_rad ,

p ha s e

i n s h i f t

17

// R e s u l t

 

18

// Time

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

=

100

KHZ

19

//

0 . 0 0 0 0 1

 

20

// Time

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

= 1GHZ

 

2

21

//

1 . 0 0 0D09

 

22

//

p ha s e

 

s h

i

f

t

i n

d e g r e e s

 

23

//

9 0 .

 

24

//

p ha s e

 

s h

i

f

t

i n

r a d i a n s

 

25

//

1 . 5 7 0 6 8 0 6

 

Scilab code Exa 1.2 Example 1.2

 

1

// Caption : Program s h i f t

to

c a l c u l a t e

time

period

 

and

phase

2

// Example1 . 1

 

3

// Page

8

4

clear ;

5

clc ;

 

6

close ;

 

7

f1

=

10^5;

 

//

f 1

= 100KHz

 

8

f2

=

10^9;

//

f 2

= 1GHz

9

T1

=

1/ f1 ;

 

10

T2

=

1/ f2 ;

11

phi

=

(1/4) *360;

 

12

phi_rad

 

=

phi /57.3;

 

13

disp ( T1 , ’ Time

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

=

 

100

KHZ ’ )

 

14

disp ( T2 , ’ Time GHZ ’ )

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

=

1

15

disp ( phi ,

’ p ha s e

s

h i f t

d e g r e e s ’ ) ;

i n

r a d i a n s ’ ) ;

 

16

disp ( phi_rad ,

p ha s e

i n s h i f t

17

//

R e s u l t

 

18

// Time

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

=

100

KHZ

19

//

0 . 0 0 0 0 1

 

20

// Time

p e r i o d

of

s i n e

wave

wi t h

f r e q u e n c y

= 1GHZ

 

21

//

1 . 0 0 0D09

 

22

//

p ha s e

 

s h

i

f

t

i n

d e g r e e s

 

23

//

9 0 .

 

24

//

p ha s e

 

s h

i

f

t

i n

r a d i a n s

 

25

//

1 . 5 7 0 6 8 0 6

 

3

Scilab code Exa 1.4

 

1 // Caption : Shannon

Channel

Capacity

formula

 

2

// Example1 . 4

 

3

// page

12

 

4

clear ;

5

clc ;

6

close ;

7

B

=

10^6;

 

//

Bandwidth

of

n o i s y

c h a n n el

10MHZ

 

8

S_N

=

1;

// s i g n a l ton o i s e

r a t i o n

i s

1

9

C

=

B *

log2 (1+ S_N ) ;

 

10

maximum

c a p a c i t y

f

o r

t

h

i s

c h a n n el

i n

disp (C , ’ The b i t s / sec

C

= ’ )

 

11

// R e s u l t

12

// The

maximum

c a p a c i t y

f o r

t h i

s

c h a n n el

i n

b i t s / s e c

C

=

1000000.

 

Scilab code Exa 1.51

// Ca p tio n : C a pa ci t y

 

of

a

c h a n n el

using

shannon ’ s

formula

 

2

// Example1 . 5

 

3

// page

12

 

4

clear ;

5

clc ;

6

close ;

7

fLow

=

3*(10^6) ;

// low

f r e q u e n c y

= 3MHz

 

8

fHigh

=

4*(10^6) ;

// hi h g

f r e q u e n c y

= 4MHz

 

9

S_N_dB

=

20;

// s i g n a l to n o i s e

r a t i o

20

dB

10

S_N

=

10^( S_N_dB /10) ;

 

11

B

=

fHigh

 

-

fLow ;

 

12

C

=

B *

log2 (1+ S_N ) ;

13

14

disp (B , ’ ’

disp (C ,

Bandwidth

C a p a ci t y

i n

of

Hz

B

=

)

c h a n n el

i n

b i t s / s

C

= ’ )

15

disp ( S_N

,

s i g n a l

to

a n o i s e

r a t i o

S/N =

e c s ’ )

 

16

// R e s u l t

17

//

Bandwidth

i n

Hz

B

=

i n

1 0 0 0 0 0 0 . b i t s / s e c s

 

18

//

C a p a ci t y

of

a

c h a n n el

C

=

6658211.5

 

19

//

s i g n a l

 

to

n o i s e

r a t i o

S /N

=

1 0 0 .

 

4

 

Scilab code Exa 1.61

// Ca p tio n : Program

to

c a l c u l a t e

 
 

a tt en ua ti on

( or )

l o s s

os

power

 

2

// Example

 

1.6

 

3

// page

14

4

clear ;

5

clc ;

6

close ;

7

P1

=1;

// one

watt

 

8

P2

=

P1 /2;

 

//

reduced

 

by

h a l f

value

 

9

Atten_dB

=

10* log10 ( P2 / P1 ) ;

 

10

disp ( Atten_dB , ’ A t t e n u a ti o n

i n

dB

=

)

;

11

power_lost

 

=

10^( Atten_dB /10)

 

12

disp ( power_lost , ’ The

 

amount

of

power

 

l o s t

=

)

;

13

//

R e s u l t

 

14

//

A t t e n u a ti o n

i n

dB

=

3 . 0 1 0 3

 

15

// The amount of power

l o s t

=

0 . 5

 

Scilab code Exa 1.71 // Ca p tio n : Power g ai n c a l c u l a t i o n

 
 

f o r

a

s i g n a l

t r a v e l l i n g

from

 

2

// one point to another point

 

3

// Example

 

1.7

 

4

// page

14

5

clear ;

6

clc ;

7

close ;

8

Loss_line1

 

=

-9;

//9 dB

 

9

Amp_gain2

 

=

14;

// 14

dB

10

Loss_line3 =

-3;

//3 dB

 

11

dB_at_line4 = Loss_line1 + Amp_gain2 + Loss_line3 ;

 

12

disp ( dB_at_line4 , ’ The amount of power g ai n e d by a

 
 

s i g n a l

 

t r a v e l l i n g

from

p o i n t 1

to

p o i n t 4

i n

dB

=

)

     

13

// R e s u l t

 
 

5

14

// The

amount

of

power

g ai n e d

by

a

s i g n a l 2 .

t r a v e l l i n g

from

p o i n t 1

to

p o i n t 4

i n

dB

=

 

6

Chapter 2 Second chapter

Scilab code Exa 2.1

1 // Caption : C r i t i c a l

Angle

of

i n c i d e n c e

2

// Example 2.1

 

3

// page 37

 

4

clear ;

5

close ;

6

clc ;

 

7

n1 = 1.48;

 

8

n2 = 1.00;

9

phic

=

asin ( n2 / n1 ) ;

 

10

disp ( phic *57.3 , ’ T o t al

I n t e r f l e c t i o n

a n g l e

 

:

c r i t i c a l

angle

of

i n c i d e n c e

in

r e f l e c t i o n degrees ’ )

11

//

R e s u l t

 

12

// T o t al

I n t e r f l e c t i o n

r e f l e c t i o n

a n g l e : c r i t i c a l

 

angle

of

i n c i d e n c e

42.509773

 

Scilab code Exa 2.21

// Ca p tio n :

Fi n di n g

a n gl e ,

 

numerical

aperture ,

acceptance

C r i t i c a l angle

2

// Example 2.2

 

3

// page 45

 

4

clear ;

5

close ;

6

clc ;

 

7

7

n1

=

1.48;

// core

r e f r a c t i v e

index

 

8

n2

=

1.46;

// cladding

index

 

9

phic

=

asin ( n2 / n1 ) *57.3;

 

10

NA

=

sqrt ( n1 ^2

-

n2 ^2) ;

11

phi0

=

asin ( NA ) *57.3;

 

12

disp ( phic ,

C r i t i c a l

a n l g e ’ )

 

13

disp ( NA ,

’ n u m e r i c a l

a p e r t u r e ’ )

 

14

disp ( phi0 ,

a c c e p t a n c e

a n g e l

i n

a i r ’ )

15

//

R e s u l t

 

16

//

C r i t i c a l

a n l g e

 

17

//

8 0 . 5 7 5 9 2 7

18

//

n u m e r i c a l

a p e r t u r e

 

19

//

0 . 2 4 2 4 8 7 1

 

20

//

a c c e p t a n c e

a n g e l

i n

a i r

 

21

//

1 4 . 0 3 4 4 1 2

 

Scilab code Exa 2.31 // Ca p tio n : Program

to

C a l c u l a t e

 
 

NORMALIZED FREQUENCY

’V’

and

N um e ri cal

A p e r t u r e

2

// Example2 . 3

 

3

// Page 58

4

clear

all ;

5

close ;

6

clc ;

 

7

a = 25 e -06;

 

8

Lambda

=1300 e -09;

 

9

V

=

26.6;

 

10

Numerical_Aperture = V * Lambda /(2* %pi * a )

 

11

disp ( Numerical_Aperture , ” N um e ri cal

i s

)

;

12

disp ( M

=

( V ^2) /2 ,

T o t al

number

of

A p e r t u r e modes M

e n t e r i n g

 

the

f i b e r

i s

:

)

13

// R e s u l t

 

14

//

N um e ri cal

A p e r t u r e

i s

:

0 . 2 2 0 1 4 3 1

 

15

//

T o t al

number

 

of

modes M

e n t e r i n g

t h e

f i b e r

i s

:

 

353.78

 
 

8

 

Scilab code Exa 2.41

// Ca p tio n : Power

f l o w

i n

t h e

c o r e

and

 

cladding

of

step index

f i b e r

 

2

// Example

 

2.4

3

// page

62

4

clear ;

5

close ;

6

clc ;

7

V

=

[22 ,39];

 

8

M

= V ^2/2;

 

9

Pcladd_P

=

(4/3) *( M .^( -0.5) ) ;

 

10

Pcore_P

=

1 -

Pcladd_P ;

 

11

disp (M ,

’ T o t al

number

of

modes

)

12

disp ( Pcladd_P

*100 ,

P e r c e n t a g e

of

power

p r o p a g a t e s

i n

 

the

cladding ’ )

 

13

// R e s u l t

 

14

//

T o t al

number

of

modes

15

//

2 4 2 .

7 6 0 . 5

 

16

//

P e r c e n t a g e

of

power

p r o p a g a t e s

i n

t h e

c l a d d i n g

17

//

8 . 5 7 0 9 9 1 3

 

4 . 8 3 4 9 1 8 2

 

Scilab code Exa 2.51

// Ca p tio n :

Program

to

c a l c u l a t e

 
 

Fi ber

B i r e f r i n g e n c e

BETA f

 

2

// Example2 . 5

 

3

// page 65

 

4

clear

all ;

 

5

close ;

 

6

clc ;

7

Lambda =

input ( ’ Enter

the

 

wavelength

of

Optical

 

S i g n a l ’ ) ;

 

8

Lp = input ( ’ Beat Length ’

)

;

9

BETA_f_FORMULA1 = 2* %pi / Lp ;

 

10

disp ( BETA_f_FORMULA1 , ”The

 

f i b e r

b i r e f r i e n g e n c e

u s i n g

 

formula

1” ) ;

 

11

BETA_f_FORMULA2 = Lambda / Lp ;

 

12

disp ( BETA_f_FORMULA2 , ”The

 

f i b e r

b i r e f r i e n g e n c e

u s i n g

 

formula

2” ) ;

 

13

// R e s u l t

 
 

9

14 //

E n t e r

t h e

w a v el e n g t h

of

O p t i c a l

S i g n a l

1300 e 09

// Beat

15 Length

8 e 02

// The

16 f i b e r

b i r e f r i e n g e n c e

u s i n g

f o rm ul a

1

78.539816

17 // The

f i b e r

b i r e f r i e n g e n c e

u s i n g

f o rm ul a

2

0.0000162

10

Chapter 3 Third chapter

Scilab code Exa 3.1

 

1

// Ca p tio n : Program to

Find

A t t e n u a ti o n

i n

dB/km

 

2

// Example3 . 1

 

3

// page

 

91

4

clear ;

 

5

clc ;

6

z

=

[1

2];

// d i a t a n c e s

are

in

k i l o m e t e r

 

7

alpha_in_dB_per_km

=

3;

8

r

=

( alpha_in_dB_per_km * z ) /10;

 

9

P0_Pz

=