Engineering Physics Delhi Technological University
INTRODUCTION TO COMPUTING (EP-201)
Assignment: 1
1. Write a function file to print the first N terms of the famous Fibonacci series of
thirteenth century.
Fibonacci series: 1, 1, 2, 3, 5, 8, 13, 21, ……………….
2. Write a function Script to calculate the sum of series say S5; x and power of x should be
given as input in the function file.
1
S5=
1
x5 +
1
x4 +
1
x3 +
1
x2 +
x1
3) Fundamental mode (LP01) of an optical fiber is having Gaussian shape. Radial
distribution of this function is given by
ψ (r ) = A0 * e − ( r − r )
2
0 / w02
where A0, r0 and w0 are constants.
(a) Write a function script to calculate the radial distribution of Gaussian function
defined above with A0, r0, w0 and r as input.
Call this function file in another Script file
(b) To plot the Gaussian field for r0 = 0, 2, 4…..10 (take A0 = 1, w0 = 4
and −20 ≤ r ≤ 20 ). Title of the above plot should indicate properly the values of
the constants A0 and w0.
(c) To plot the Gaussian field for w0 = 2, 4…..10 (take A0 = 1, r0 = 0
and −20 ≤ r ≤ 20 ). Title of the above plot should indicate properly the values of
the constants A0 and r0.
(d) To plot the Gaussian field for A0 = 2, 4…..10 (take r0 = 0, w0 = 4
and −20 ≤ r ≤ 20 ). Title of the above plot should indicate properly the values of
the constants r0 and w0.
4. Write a function file ([Link]) that compute the factorial of a given number.
5. Use IFACT.m function file to calculate the Sine of an angle:
Engineering Physics Delhi Technological University
x3 x5 x7 x9
Sin( x) =x − + − +
3! 5! 7! 9!
Compare the results of user defined function with the MATLAB inbuilt Sin(x) function.
6. The value of e can be written by using infinite series:
n =∞
1
e=∑
n =0 n !
Fix n upto 50 and calculate the approximated value of e (IFACT.m function file for
factorial calculation). Compare the result with MATLAB inbuilt function.
7. Assume that the complex function f (t ) is defined by equation
f (t ) = (0.5 − 0.25i )t − 1.0
Plot the amplitude and phase of function f for 0 ≤ t ≤ 4.
8. The ratio of the output voltage V0 to the input voltage Vi in a high pass filter is given
by the equation
V0 j 2π fRC
=
Vi 1 + j 2π RC
Assume that R = 16 k Ω and C = 1 µF . Calculate and plot the amplitude and phase
response of this filter as a function of frequency.