Prof. Vladimir A. Dobrushkin
This tutorial contains many matlab scripts.
You, as the user, are free to use all codes for your needs, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. Any comments and/or contributions for this tutorial are welcome; you can send your remarks to
A circuit is an unbroken loop of conductive material that allows electrons to flow through continuously without beginning or end. If a circuit is “broken,” that means its conductive elements no longer form a complete path, and continuous electron flow cannot occur in it. The location of a break in a circuit is irrelevant to its inability to sustain continuous electron flow. Any break, anywhere in a circuit prevents electron flow throughout the circuit.
When charge flows through the wires of an electric circuit, current is said to exist in the wires. Electric current is a quantifiable notion which is defined as the rate at which charge flows past a point on the circuit. It can be determined by measuring the quantity of charge that flows past a cross-sectional area of a wire on the circuit. As a rate quantity, current (I) is expressed by the following equation:
As charge flows through a circuit, it encounters resistance or a hindrance to its flow. Like current, resistance is a quantifiable term. The quantity of resistance offered by a section of wire depends upon three variables - the material the wire is made out of, the length of the wire, and the cross-sectional area of the wire. One physical property of a material is its resistivity - a measure of that material's tendency to resist charge flow through it. Resistivity values for various conducting materials are typically listed in textbooks and reference books. Knowing the resistivity value ( \( \rho \) ) of the material the wire is composed of and its length (L) and cross-sectional area (A), its resistance (R) can be determine using the equation below.
The standard metric unit of resistance is the ohm (abbreviated by the Greek letter \( \Omega \) ). The main difficulty with the use of the above equation pertains to the units of expression of the various quantities. The resistivity ( \( \rho \) ) is typically expressed in ohm•m. Thus, the length should be expressed in units of m and the cross-sectional area in \( m^2 \). Many wires are round and have a circular cross-section. As such, the cross-sectional area in the above equation can be calculated from knowledge of the wire's radius or diameter using the formula for the area of a circle.
The amount of current that flows in a circuit is dependent upon two variables. Current is inversely proportional to the overall resistance (R) of the circuit and directly proportional to the electric potential difference impressed across the circuit. The electric potential difference (ΔV) impressed across a circuit is simply the voltage supplied by the energy source (batteries, outlets, etc.). For homes in the United States, this value is close to 110-120 Volts. The mathematical relationship between current (I), voltage and resistance is expressed by the following equation (which s sometimes referred to as the Ohm's law equation):
The standard metric unit of power is the Watt.
It is quite common that a circuit consist of more than one resistor. While each resistor has its own individual resistance value, the overall resistance of the circuit is different than the resistance of the individual resistors which make up the circuit. A quantity known as the equivalent resistance indicates the total resistance of the circuit. Conceptually, the equivalent resistance is the resistance that a single resistor would have in order to produce the same overall effect on the resistance as the combination of resistors which are present. So if a circuit has three resistors with an equivalent resistance of 25 ohm, then a single 25-ohm resistor could replace the three individual resistors and have the equivalent effect upon the circuit. The value of the equivalent resistance ( \( R_{eq} \) ) takes into consideration the individual resistance values of the resistors and the way in which those resistors are connected.
There are two basic ways in which resistors can be connected in an electrical circuit. They can be connected in series or in parallel. Resistors which are connected in series are connected in consecutive fashion such that all the charge that passes through the first resistor will also pass through the other resistors. In series connection, all of the charge flowing through the circuit passes through all the individual resistors. As such, the equivalent resistance of series-connected resistors is the sum of the individual resistance values of those resistors.
Inductors are used to reduce the change in current. Usually made up of wire conductors wrapped in coils, inductors create a “back emf” (in Henrys) inverse to the change in the magnetic field flux caused by changing current. Proportional to the change in current, this emf (electromotive force) increases for large changes in the current smoothing out the current over time. Because inductors pass low frequencies much more easily than high frequencies, they are often used as filters on sub-woofers in speaker systems. The reason to use an inductor there is that it doesn't "consume" or "waste" the high frequency energy, it just blocks it from passing, so that energy can then pass through the capacitor, to the tweeter, instead.
When an inductor and resistor are placed in sequence in a circuit powered by a battery of emf \( \varepsilon_0 \) (see fig below) the voltage given by a combination of Ohm’s and Kirchhoff’s law is:
R := 3
L := 0.025
o := ode({y' (t) = (V- y(t) *R)/L, y(0) =0}, y(t))
solve(o)
plot(p, TicksDistance = 2.0, GridVisible = TRUE, SubgridVisible = TRUE):
An LC circuit is a closed loop with just two elements: a capacitor and an inductor. It has a resonance property like mechanical systems such as a pendulum or a mass on a spring: there is a special frequency that it likes to oscillate at, and therefore responds strongly to. LC circuits can be used to tune in to a specific frequency, for example in the station selector of a radio or television.
In an LC circuit, electric charge oscillates back and forth just like the position of a mass on a spring oscillates. To demonstrate the analogy, we list several corresponding equations for a mechanical spring and an LC circuit.
Mechanical spring | LC circuit |
position x | charge q |
velocity \( v= \dot{x} = \frac{{\text d}x}{{\text d}t} \) | current \( I = \dot{q} = \frac{{\text d}q}{{\text d}t} \) |
kinetic energy \( \frac{1}{2}\, mv^2 \) | Inductor energy \( \frac{1}{2}\, L\, I^2 \) |
potential energy \( \frac{1}{2}\, k x^2 \) | Capacitor energy \( \frac{1}{2} \left( \frac{1}{C} \right) q^2 \) |
equation of motion \( m\,\dot{v} + k\,x =0 \) | Kirchhoff's law \( L\,\frac{{\text d}I}{{\text d}t} + \frac{q}{C} =0 \) |
frequency \( \frac{1}{2\pi} \, \sqrt{\frac{k}{m}} \) | frequency \( \frac{1}{2\pi} \, \frac{1}{\sqrt{LC}} \) |
The parameters that determine the motion of a spring are the mass m, spring constant k, the position x, and the velocity v which is the rate of change of x. The parameters that determine the behavior of an LC circuit are L, C, q and I which is the rate of change of q. Thus there is a one-to-one correspondence since the equations of motion are identical given the substitutions:
The characteristic frequency of an LC circuit is the frequency at which large amplitudes are built up when a driving force is applied at that frequency. A child on a swing will be sensitive to a pushing force which comes regularly with the natural frequency of the swing. A force that comes at a different frequency will not build up a large amplitude as it will often be pushing against the child's motion. The magic frequency is called the resonant frequency.
First, we will create an RC-circuit with the resistor and capacitor in series. We need to create variables (wire1, res1, res2, etc.) that hold a plot of a line segment that will be part of our circuit, then we need to create a single variable (here, we use eq) that incorporates all of these smaller lines. Once we plot this variable (with an appropriate viewing box and no visible axes), we will have a diagram of our circuit, and we can delete all of these variables from memory. For example, we can write:
res1 := plot::Line2d([7,10],[7.25,11])
res2 := plot::Line2d([7.25,11],[7.75,
res3 := plot::Line2d([7.75,9],[8.25,
res4 := plot::Line2d([8.25,11],[8.75,
res5 := plot::Line2d([8.75,9],[9.25,
res6 := plot::Line2d([9.25,11],[9.75,
res7 := plot::Line2d([9.75,9],[10.25,
res8 := plot::Line2d([10.25,11],[10.5,
wire2 := plot::Line2d([10.5,10],[15,10]
wire3 := plot::Line2d([15,10],[15,4]):
wire4 := plot::Line2d([15,4],[9,4]):
cap1 := plot::Line2d([9,3],[9,5]):
cap2 := plot::Line2d([8.5,3],[8.5,5]):
wire5 := plot::Line2d([8.5,4],[2,4]):
eq := wire1, res1, res2, res3, res4, res5, res6, res7, res8, wire2, wire3, wire4, cap1, cap2, wire5:
plot(eq, ViewingBox = [0..21,0..13], Axes = None): delete eq, wire1, res1, res2, res3, res4, res5, res6, res7, res8, wire2, wire3, wire4, cap1, cap2, wire5:
We can also plot a circuit where the resistor and capacitor are in parallel. All of the same techniques apply, we simply put the components in different locations. To do this, we type:
wire2 := plot::Line2d([10,10],[10,7.25]):
cap1 := plot::Line2d([9,7.25],[11,7.25]):
cap2 := plot::Line2d([9,6.75],[11,6.75]):
wire3 := plot::Line2d([10,6.75],[10,4]):
wire4 := plot::Line2d([15,10],[15,8.75]):
res1 := plot::Line2d([15,8.75],[16,8.5]):
res2 := plot::Line2d([16,8.5],[14,8]):
res3 := plot::Line2d([14,8],[16,7.5]):
res4 := plot::Line2d([16,7.5],[14,7]):
res5 := plot::Line2d([14,7],[16,6.5]):
res6 := plot::Line2d([16,6.5],[14,6]):
res7 := plot::Line2d([14,6],[16,5.5]):
res8 := plot::Line2d([16,5.5],[15,5.25]):
wire5 := plot::Line2d([15,5.25],[15,4]):
wire6 := plot::Line2d([15,4],[2,4]):
eq := wire1, wire2, cap1, cap2, wire3, wire4, res1, res2, res3, res4, res5, res6, res7, res8, wire5,wire6:
plot(eq, ViewingBox = [0..21,0..13], Axes = None): delete eq, wire1, wire2, cap1, cap2, wire3, wire4, res1, res2, res3, res4, res5, res6, res7, res8, wire5, wire6:
Sometimes we want to add inductors to our circuits. Instead of the linear curves that we plotted to get other components, we must use a parametric curve to create an inductor.
ind1 := plot::Curve2d([.4*sin(t)+.1*t+
wire2 := plot::Line2d([13.7,5],[18.7,5]
eq := wire1, ind1, wire2:
plot(eq, ViewingBox = [0..20,0..10], Axes = None):
delete eq, wire1, ind1, wire2:
The following code is intended to be used in order to draw resistors in circuits. It is a triangular wave function, whose amplitude (a) and height (z) can easily be changed through parameters in the function. This resistor function makes use of the floor function, which rounds down to the nearest integer.
plot(f(x,.5,5), x = 0..10, ViewingBox = [0..10,0..10])
This is an example of a resistor in a circuit complete with a capacitor and inductor. Here, the amplitude is .5, the function is shifted up 5, and the domain of the resistor is [10,15].
res1 := plot::Function2d((2/.5)*(x-.5*floor(x/.5+.5))*((-1)^(floor(x/.5+.5)))+5, x = 10..15):
wire2 := plot::Line2d([15,5],[20,5]):
wire3 := plot::Line2d([5,5],[5,10]):
wire4 := plot::Line2d([5,10],[10,10]):
ind1 := plot::Curve2d([.55*sin(t)+.14*t+9.8, .55*cos(t)+10], t=4.5..33.25):
wire5 := plot::Line2d([15,10],[20,10]):
wire6 := plot::Line2d([20,10],[20,7.75]):
cap1 := plot::Line2d([19,7.75],[21,7.75]):
cap2 := plot::Line2d([19,7.25],[21,7.25]):
wire7 :=plot::Line2d([20,7.25],[20,5]):
eq := wire1, res1, wire2, wire3, wire4, ind1, wire5, wire6, cap1, cap2, wire7:
plot(eq, ViewingBox = [0..25,0..15], Axes = None)
Example. An inductor, also called a coil, is a passive two-terminal electrical component that consists of a conductor such as a wire, usually wound into a coil. When the current flowing through an inductor changes, the time-varying magnetic field induces a voltage in the conductor, that always opposes a change in current. The standard unit of inductance is the henry, abbreviated H. This is a large unit. More common units are the microhenry, abbreviated μH (1 μH = 10-6H) and the millihenry, abbreviated mH (1 mH = 10-3 H).
A capacitor is an electronic device that stores charge and energy. Capacitors can give off energy much faster than batteries can, giving them much higher power density than batteries with the same amount of energy. A capacitor holds very little energy compared to a battery, in general. It will smooth out short spikes in current, but will not help with longer bumps or continuous demand. Inductors are used with capacitors in various wireless communications applications. An inductor connected in series or parallel with a capacitor can provide discrimination against unwanted signals. Large inductors are used in the power supplies of electronic equipment of all types, including computers and their peripherals.
Consider an electric circuit, consisting of an inductor and capacitor, in series. To be more specific, assume that the capacitor is varied as a given function of time in a step wise fashion about its mean capacitance, C0, by a small amount. The charge q(t) on the capacitor satisfies the linear ordinary differential equation with periodic coefficient (dot stands for the derivative with respect to time t):
q1m[t_] = q[t] /. s
q1p[t_] = Simplify[q1p[t] /. s]
function Complete
Complete