Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
107 views5 pages

MATLAB for Dynamic Circuit Analysis

This document discusses analyzing dynamic linear circuits in MATLAB. It describes transforming circuits into the complex frequency domain using the Laplace transform to obtain algebraic equations that can be solved using circuit analysis techniques. MATLAB allows symbolic computation, avoiding difficult manual calculations and making it easy to find the complete response of second and higher-order dynamic circuits.

Uploaded by

ludokellyp
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)
107 views5 pages

MATLAB for Dynamic Circuit Analysis

This document discusses analyzing dynamic linear circuits in MATLAB. It describes transforming circuits into the complex frequency domain using the Laplace transform to obtain algebraic equations that can be solved using circuit analysis techniques. MATLAB allows symbolic computation, avoiding difficult manual calculations and making it easy to find the complete response of second and higher-order dynamic circuits.

Uploaded by

ludokellyp
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/ 5

Transactions on Electrical Engineering, Vol. 4 (2015), No.

3 64

Analysis of Dynamic Circuits in MATLAB


Iveta Tomčíková 1)
1)
Technical University in Košice/Department of Theoretical and Industrial Electrical Engineering, Košice, Slovakia,
e-mail: [email protected]

Abstract — The paper deals with the proposal for the


analysis of dynamic linear circuits in the MATLAB II. FINDING THE COMPLETE RESPONSE OF DYNAMIC
environment. A very powerful tool for the analysis of the CIRCUIT IN COMPLEX FREQUENCY DOMAIN
circuits is to transform the circuits directly into the complex
frequency domain using the Laplace transform and then A. The Laplace Transform and the Inverse Laplace
apply the circuit analysis techniques to solve them. Applying Transform
above-mentioned methods together with the symbolic The solution of dynamic circuits in the complex
computation of MATLAB, there is no difficulty in finding frequency domain proposes two procedures. The first
the complete response of second and higher-order dynamic procedure consists of the following steps: the
circuits. representation of the dynamic circuit in the time domain
by differential equations and using the Laplace transform
Keywords — Dynamic circuit, circuit analysis, complete to transform the differential equations into algebraic
response, Laplace transform, symbolic computation, MATLAB. equations. The second procedure involves the
representation of the dynamic circuit in the complex
I. INTRODUCTION frequency domain directly using the Laplace
The circuit analysis is very important part of electrical transformation and then the circuit analysis, thus in this
engineering education at the university level. Traditional case it will be eliminated the need to write differential
didactic methods and highly specialized software package equations representing the circuit.
such as PSPICE that offers flexible approach to circuit The Laplace transform for a time-domain function
analysis and design are nowadays usually used for f (t ) (it is zero for t < 0 ) of a real variable t is [1], [2]
teaching of the circuit analysis. PSPICE is very helpful
tool for the numerical circuit analysis, but it hides to ∞
F ( s ) = L { f (t )} = ∫ f (t ) e − st d t
students a considerable fact that a symbolic model of the
(1)
circuit is behind the numerical results.
0
Better way to teach students the circuit analysis is to use
software product that provides symbolic manipulation and where s is a complex variable (meaning the complex
can be used for symbolic circuit analysis, e.g. MATLAB, frequency, s = σ + jω ), and F ( s ) is a complex frequency
Maple, Mathematica, etc. Especially MATLAB is function.
widespread software that is a very appropriate for lots of For every function f (t ) a unique function F ( s ) exists.
different university courses. The MATLAB environment
is very user-friendly with powerful built-in routines that This can be written as
enable to solve a very wide variety of computations. Its
great advantage is the fact that the user has not to spend f (t ) = L −1
{F ( s )} (2)
time in learning the software but he can spend time in
learning the principles of a given problem. meaning that f (t ) is the inverse Laplace transform of the
The analysis of dynamic circuits implies the process of complex frequency function F ( s ) and exists for t ≥ 0 .
finding the complete response of dynamic circuits that The inverse Laplace transform is defined by the integral
involves solving of first, second and higher-order circuits [1], [2]
in the time domain or in the complex frequency domain
using the Laplace transform. In the time domain, the σ + j∞
1
dynamic circuits are represented by the equations in form
of differential equations, and in the complex frequency
f (t ) = ∫
2π j σ − j∞
F ( s ) e st d s . (3)
domain, the dynamic circuits are represented by a set of
simultaneous algebraic equations, thus the circuit analysis
techniques for resistive circuits can be used. However, in
the both cases the analysis of dynamic circuits is
sometimes a time-consuming activity. Finding the
complete response of dynamic circuits in the complex B. Complex Frequency-Domain Representation of Circuit
frequency domain using MATLAB greatly reduces the Elements
effort demanded to solve the set of algebraic equations The complex frequency-domain (s-domain) repre-
and to take the inverse Laplace transform made by hand, sentation of circuit elements is obtained using the Laplace
thus there is no difficulty in solving dynamic circuits. transform of their voltage-current relationships.

TELEN 2015011
Transactions on Electrical Engineering, Vol. 4 (2015), No. x 65

The voltage-current relationship for a linear resistor the dynamic circuit with its initial conditions is obtained,
having resistance R in the s-domain [1], [2] is and the circuit analysis techniques to solve the voltages
and/or currents can be used.
U ( s) = R I (s) (4) Usually two systematic circuit analysis techniques are
where U ( s ) is the Laplace transform of voltage u (t ) used: the mesh analysis and the node analysis. Applying
one of these methods to the circuit, a set of mesh or node
across the resistor, and I ( s ) is the Laplace transform of equations is constituted by inspection. The mesh or node
current through the resistor. equations form a square system (the number of unknown
The voltage-current relationship for a linear inductor is equal to the number of equations) of simultaneous
having inductance L in the s-domain [1], [2] is algebraic equations containing the complex frequency s ,
thus it can be expressed in a matrix-vector form
U ( s ) = sL I ( s ) − Li (0) (5)
A ( s ) x ( s ) = b( s ) (8)
where U ( s ) is the Laplace transform of voltage u(t )
across the inductor, I ( s ) is the Laplace transform of where A( s ) is the coefficient matrix, x ( s ) is a single
current through the inductor and i (0) is the initial column vector of unknowns (the mesh currents or node
voltages), and b( s ) is the single right-hand side column
condition.
vector.
The equation (5) is used to represent the linear inductor
in the s-domain as the series connection of two circuit Solving the set of equations (8)
elements that corresponds to the sum of the voltages on
the right-hand side of (5). x ( s ) = A −1 ( s ) b( s ) (9)
The voltage-current relationship for a linear capacitor the mesh currents or node voltages, described by a ratio of
having capacitance C in the s-domain [1], [2] is polynomials in the complex variable s, are obtained.
If the mesh analysis is applied to the circuit, the
1 u(0)
U ( s) = I ( s) + (6) s-domain element currents i( s ) are found as linear
sC s combination of the s-domain mesh currents x ( s )
where U ( s ) is the Laplace transform of voltage u(t )
across the capacitor, I ( s ) is the Laplace transform of i( s ) = K c x ( s ) (10)
current through the capacitor and u(0) is the initial where K c is a matrix containing elements 0, +1, and
condition. –1.
The equation (6) is used to represent the linear capacitor The s-domain element voltages can be expressed using
in the s-domain as the series connection of two circuit the Laplace transform of element voltage-current
elements that corresponds to the sum of the voltages on relationships.
the right-hand side of (6).
If the node analysis is applied to the circuit, the
The voltage-current relationship for the coupled s-domain element voltages u( s ) are found as linear
inductors having self-inductances L1 , L2 and mutual
combination of the s-domain node voltages
inductance M in the s-domain [1], [2] is
u( s ) = K v x ( s ) (11)
U1 ( s )   sL1 ± sM   I1 ( s )   L1 ± M   i1 (0) 
U ( s ) =  ± sM sL   I ( s )  −  ± M L  i (0)  (7) where K v is a matrix containing elements 0, +1, and
 2   2  2   2  2 
–1.
where U1 ( s ),U 2 ( s ) is the Laplace transform of voltages The s-domain element currents can be expressed using
u1 (t ), u2 (t ) across the inductors L1 , L2 respectively, the Laplace transform of the element voltage-current
relationship.
I1 ( s ), I 2 ( s ) is the Laplace transform of currents through
To get the complete response of the dynamic circuit in
the inductors L1 , L2 respectively, and i1 (0), i2 (0) are the the time domain, it is necessary to take the inverse
initial conditions. Laplace transform of the obtained s-domain element
Independent voltage and current sources are represented voltages and currents.
by the Laplace transform of their voltages and currents.
The dependent voltage and current sources are represented
by the Laplace transform of their controlled voltages and III. EXAMPLES OF CIRCUIT ANALYSIS USING THE LAPLACE
currents, and controlling voltages and currents. TRANSFORM IN MATLAB
The ideal operational amplifier operates in the same Most of the steps for finding the complete response of a
way in the s-domain as it does in the time domain, thus the dynamic circuit given above can be easily executed using
Laplace transform of its operating conditions is applied in the MATLAB environment.
the s-domain. The following text contains two representative
examples of the circuit analysis using the Laplace
C. Circuit Analysis Using the Laplace Transform transform in MATLAB. The analytical results of the
After replacing all the circuit elements by their solution together with the analysis in MATLAB and the
s-domain representation, the s-domain representation for graphical representation of the obtained results are given.

TELEN 2015011
Transactions on Electrical Engineering, Vol. 4 (2015), No. x 66

A. Analysis of Second-Order Circuit for the Overdamped,


Critically Damped and Underdamped Case

The circuit shown in Fig. 1 is at steady state before the


switch is changed from position 1 to position 2 at time
t=0.
Suppose that u1 = 12 V, and u2 = 24 V. Determine the
element currents and voltages for t > 0 for three different
sets of values of R1 , R2 , L and C:

a) R1 = 10 Ω, R2 = 2 Ω, L = 2 H, C = 1 4 F,
b) R1 = 12 Ω, R2 = 4 Ω, L = 2 H, C = 1 8 F,
c) R1 = 2 Ω, R2 = 8 Ω, L = 1 H, C = 1 16 F.
Fig. 2. The MATLAB program composed for analysis of the circuit
shown in Fig. 1 using the Laplace transform.

The branch currents for the critically damped case (for


values of element parameters given in b) expressed in the
analytical form are shown in Fig. 3.

Fig. 1. Second-order circuit for the circuit analysis using the Laplace
transform in MATLAB – Example A.

Since the circuit, driven by the DC voltage source, u1 ,


is supposed to be at steady state before the switch is
changed from position 1 to position 2, the initial
conditions, the current i (0) through inductor and the
voltage u (0) across capacitor, can be found to be:
Fig. 3. The t-domain branch currents of the circuit shown in Fig. 1.
u1 R2
i (0) = , u(0) = u1 . (12)
R1 + R2 R1 + R2 MATLAB provides many functions to represent data
graphically, thus there is no problem to plot the t-domain
branch currents versus time (Fig. 4).
The s-domain representation of the circuit with the
initial conditions is solved using the mesh analysis.
The mesh equations with unknowns (mesh currents)
I1 ( s ), I 2 ( s ) can be written in a matrix-vector form:

 1 1   u2 − u(0) 
 R1 + sL + sC ,− sC   I1   s
+ Li (0)
  =  (13)
− 1 , 1   I 2   u(0) 
R2 +
 sC sC   s 

All the remaining computations for solving of the


circuit (with given parameters) were done by running the
MATLAB program (Fig. 2). The MATLAB program is a
set of MATLAB built-in instructions that are saved in
M-file with extension .m (a dot and suffix m). Fig. 4. The t-domain currents of the circuit shown in Fig. 1 versus time.

TELEN 2015011
Transactions on Electrical Engineering, Vol. 4 (2015), No. x 67

The graphical representation of the t-domain element The time domain representation of the voltage uout of
voltages versus time for the critically damped case is in the circuit for time t > 0 was determined in analytical
Fig. 5. form (Fig. 8).

Fig. 7. The MATLAB program composed for the circuit analysis


shown in Fig. 6 using the Laplace transform.

Fig. 5. The t-domain element voltages of the circuit shown in Fig. 1


versus time.

B. The Complete Response of Second-Order Circuit


Containing Operational Amplifier

The circuit shown in Fig. 6 is at steady state before the


input voltage uin = 1 V at time t = 0 is applied. Find the Fig. 8. The t-domain output voltage (analytical form) of the circuit
output voltage uout (t ) for t > 0 . shown in Fig. 6.

Suppose that: R1 = 1 kΩ, R2 = 200 Ω, C1 = 0.125 mF,


C2 = 50 µF, and all the initial conditions are zero. In Fig. 9 the graphical representation of the voltage
uout of the circuit and the input voltage for time t > 0 is
shown.

Fig. 6. Second-order circuit for the circuit analysis using the Laplace
transform in MATLAB – Example B.

Since all the initial conditions are assumed zero, the


complete response of the circuit is the transient response
to the input unity step function applied at time t = 0 . The
s-domain representation of the circuit is solved using the
node analysis.
The node equations with voltages U1 ( s ),U 2 ( s ),U 0 ( s )
can be written in a matrix-vector form Fig. 9. The t-domain output voltage (graphical form) of the circuit
shown in Fig. 6.

 1 0 0  U1 ( s )  1 s 
 − sC 1 R + sC IV. ADVANTAGES OF PROPOSED PROCEDURE FOR ANALYSIS
−1 R1  U 2 ( s )  =  0  (14)
 1 1 1     OF DYNAMIC CIRCUITS
 0 1 R2 sC2  U 0 ( s )   0 
Using MATLAB environment for analysis of dynamic
circuits has lots of advantages but the most significant
All remaining computations for analysis of the circuit ones are the effort, time, and the analytical form of the
(with given parameters) were done by running the voltages and currents in the solved circuits.
MATLAB program (Fig. 7) for the circuit analysis It is evident that the effort demanded to solve such type
shown in Fig. 6 using the Laplace transform. of problems is greatly reduced because it is not necessary

TELEN 2015011
Transactions on Electrical Engineering, Vol. 4 (2015), No. x 68

to solve the set of algebraic equations and to take the and the steps that will be a result of running the composed
inverse Laplace transform. MATLAB program:
The elapsed time that represents the processing and • assigning the values to the parameters of given circuit,
execution of the instructions in the composed MATLAB • defining the coefficient matrix and the right-hand side
programs for given representative examples of the circuit column vector,
analysis takes very short time. For the MATLAB program
of Example A (Fig. 2) the elapsed time is 0.454 seconds, • solving the set of algebraic equations,
and for the MATLAB program of Example B the elapsed • taking the inverse Laplace transform,
time is 0.359 seconds. The complete MATLAB program • printing the symbolic (analytic) expression of sought
(all three cases with t-domain and graphical outputs) of voltages and/or currents in a format that resembles
Example A takes up 9.031 seconds only, and of Example type-set mathematics,
B takes up 2.172 seconds.
• plotting the graph of sought voltages and/or currents
The last valuable advantage of MATLAB environment versus time.
is the fact that the analytical form of the voltages and
currents in the t-domain are available after circuit analysis There exists also a possibility to compose the
in contrast with some highly specialized software MATLAB program that can do all the steps for the
packages. dynamic circuit analysis. In this case, the analysis
techniques, which enable to formulate the circuit
V. CONCLUSIONS equations in systematic and automatic way, have to be
used. Using MATLAB for solving these problems saves a
The procedure for analysis of a dynamic circuit using lot of time and effort and everybody who needs to analyse
the Laplace transform in the MATLAB environment was the circuit can concentrate on gaining an insight into
proposed. It consists of the steps that must be done by properties of the circuit, and making conclusions.
hand:
• finding the initial conditions for given circuit,
• drawing the s-domain representation of the given
circuit, REFERENCES
• applying systematic circuit analysis techniques to [1] R.C.Dorf, J.A.Svoboda: Introduction to Electric Circuits. John
s-domain representation of the given circuit and Wiley &Sons, Inc., 2007, ISBN 978-0-471-73042-2.
writing a set of simultaneous algebraic equations [2] D. Mayer: Introduction in Theory of Electric Circuits. SNTL–
containing the terms of the complex variable s; Prague, 1984 (in Czech).
rearranging the obtained set of equations in a matrix- [3] MATLAB – User’s Guide (Mathematics, Programming, Graphics),
vector form, MathWorks 2009.

TELEN 2015011

You might also like