Lab 5
Lab 5
Lab 5
Laboratory 5 1
ELEC2103 Simulation & Numerical Solutions in Engineering – 2015
f (t )e
st
F (s) dt
0
Laboratory 5 2
ELEC2103 Simulation & Numerical Solutions in Engineering – 2015
Laboratory 5 3
ELEC2103 Simulation & Numerical Solutions in Engineering – 2015
in the complex frequency domain (in terms of the complex frequency s) rather than
the time domain (in terms of time t).
Voltages v(t ) and currents i (t ) are replaced by their Laplace transforms V (s ) and
I (s ) , and the impedances of circuit elements are expressed in terms of s as follows:
a resistance of R ohms has an impedance of R ohms;
an inductance of L Henries has an impedance of sL ohms; and
a capacitance of C Farads has an impedance of 1/(sC) ohms.
Rules for combining impedances in series, etc, are as for resistors in dc analysis, and
many of the techniques of dc analysis can be used.
Relationship between Laplace analysis, dc analysis and complex phasor
analysis
Suppose we have a circuit consisting of R, L and C elements and we have obtained
general results in terms of Laplace transforms. Then
Results for steady state dc conditions can be obtained by taking s 0 , and
Results for steady state sinusoidal conditions can be obtained by substituting
s j where is the frequency in rad/s.
Exercises
Exercise 1
Use dsolve to find solutions for f (x) and g (x) if
df ( x )
1.5 f ( x ) g ( x ) 0
dx
dg ( x )
f ( x) 2g( x) 0
dx
with f (0) 0, g (0) 2 . You may find it useful to use vpa and simplify to provide a
compact display on the screen. Note that the current Matlab versions of simple and
simplify may give odd looking results.
Exercise 2
x(t ) 1
2 H
+
t0
+
1
200 F 10 v(t )
e(t ) 1
100 F
- -
In the circuit shown, the 1/100 F capacitor is charged to 5 V with the switch open and
there is no charge on the 1/200 F capacitor. At t = 0, the switch is closed. Write down
three differential equations in terms of the voltages e(t ), v(t ) and the current x(t ) . Use
Laboratory 5 4
ELEC2103 Simulation & Numerical Solutions in Engineering – 2015
MATLAB’s dsolve function to find a solution for e(t ), t 0 and plot the result over
suitable ranges. Use vpa and pretty to display a compact readable solution on the
screen.
Exercise 3
In the circuit shown, component values are in , F and H.
3 1
2 2
+
+
e1 (t ) 4
3
1 e2 (t )
-
-
Use Laplace transform methods to determine the step response of the network shown,
i.e., if e1 (t ) is the unit step function ( e1 (t ) 0, t 0 and e1 (t ) 1, t 0 ), how does
the output voltage e2 (t ) behave for t 0 ? Such an excitation could be caused by a dc
voltage source switched into the circuit at t = 0. Assume that, initially, the capacitor is
uncharged and the inductors carry no current. Use the method of mesh currents (DS
4.6). Steps in solving the problem are:
(a) Redraw the circuit, showing all elements in the complex impedance form (in
terms of s), and show the voltages as their Laplace transforms.
(b) On the same diagram, show the loop currents (Laplace transform form) as
I 1 ( s ), I 2 ( s ) , say.
(c) Write the equations required to solve for E 2 ( s ), I 1 ( s ), I 2 ( s ) in terms of E1 ( s ) .
(d) Write a script M-file that solves these equations, substitutes the Laplace
transform of E1 ( s ) to find the Laplace transform of E 2 ( s ) , finds e2 (t ) by
taking the inverse transform and plots e2 (t ) for a suitable range of positive t.
Exercise 4
In Exercise 3, the ratio G ( s ) E 2 ( s ) / E1 ( s ) of Laplace transform of output to Laplace
transform of input is the voltage gain. (In the more general setting of linear systems
analysis, such functions are called transfer functions). In the special case when
s j , G ( j ) is referred to as the frequency response.
Rewrite the M-file of Exercise 3 to calculate and plot the frequency response of the
network, i.e., plot G ( j ) versus . This circuit, in fact, acts as a low pass filter. Do
your results support this description?
Exercise 5
An important class of electronic circuits involves operational amplifiers. Consider the
problem, in the circuit shown, of determining the voltage gain E 2 ( s ) / E1 ( s ) . We will
assume that the op amp has (i) infinite input impedance and (ii) infinite voltage gain.
These are often very reasonable assumptions.
Laboratory 5 5
ELEC2103 Simulation & Numerical Solutions in Engineering – 2015
C2
R3
R1 R2 C1
E2
E1
Because of the first assumption, no current flows into the + input terminal. Because of
the second, since E 2 is finite, the differential input voltage is zero and the + input is
at a “virtual ground” potential. Thus, to determine the voltages and currents, we need
to analyse the following circuit:
C2
R3
R1 R2 C1
V E2
E1
Find the voltage gain. As good a way as any is to use Kirchhoff’s laws to write and
solve two equations in V and E 2 .
Laboratory 5 6
ELEC2103 Simulation & Numerical Solutions in Engineering – 2015
Calculating pi
One way to calculate is to randomly and uniformly pick points in the unit square
with vertices (0,0), (1,0), (0,1), (1,1) and calculate the proportion of points which lie
within unit distance of the origin. This number will be proportional to the value of .
Why? Write a MATLAB function to calculate the value of using this method. Let
the number of points to pick be an input to your function. This program can be written
with or without a for loop. Note that this method is a very inefficient way to calculate
the value of . Nonetheless, the procedure outlined here is the “essence” of the
Monte Carlo techniques found in PSPICE that are used in simulating the influence of
the variations of design parameters on integrated circuits.
Laboratory 5 7