🔌 LC Oscillator

f = 1/(2π√LC)0.159 Hz
Charge q0.00
Current I0.00
E total0.00

Frequently asked questions

What is an LC oscillator?

An LC oscillator is a circuit made of an inductor (L) and a capacitor (C) connected in a loop. Energy sloshes back and forth between the capacitor's electric field and the inductor's magnetic field, producing a sinusoidal oscillation of charge and current.

What determines the oscillation frequency?

The resonant frequency is f = 1/(2π√LC). Larger inductance or capacitance lowers the frequency; smaller values raise it. This is why tuning a radio adjusts a variable capacitor to change which station's frequency the LC circuit resonates with.

How is an LC circuit like a mass on a spring?

Charge q behaves like position, current I like velocity, inductance L like mass, and 1/C like the spring constant. Capacitor energy q²/2C mirrors spring potential energy, while inductor energy LI²/2 mirrors kinetic energy. Both systems obey the same harmonic equation.

Where does the energy go?

In an ideal LC circuit, total energy is conserved and merely transfers between the capacitor and the inductor twice per cycle. When the capacitor is fully charged, all energy is electric; a quarter-cycle later the current peaks and all energy is magnetic in the coil.

What does resistance do?

Real circuits have resistance, which dissipates energy as heat. This causes damped oscillations whose amplitude decays exponentially. With enough resistance the circuit becomes overdamped and stops oscillating altogether, returning monotonically to equilibrium.

What is the equation governing the LC circuit?

Applying Kirchhoff's voltage law gives L·q'' + R·q' + q/C = 0. Without resistance this reduces to q'' + q/(LC) = 0, the simple harmonic oscillator equation with angular frequency ω = 1/√(LC).

What is the quality factor Q?

The quality factor Q = (1/R)√(L/C) measures how many oscillations occur before the energy decays significantly. High-Q circuits ring for a long time and are highly selective in frequency — essential for sharp radio tuning.

Can an LC circuit oscillate forever?

Only the idealised lossless circuit oscillates forever. Any real inductor and capacitor have resistance, so practical oscillators need an active element (like a transistor amplifier) to inject energy each cycle and sustain a constant amplitude.

Why is it called a tank circuit?

An LC loop is nicknamed a tank circuit because it stores and exchanges energy like a reservoir, holding oscillating energy that 'sloshes' between the two components much as liquid sloshes in a tank.

What are LC oscillators used for?

LC oscillators set the operating frequency of radios, TVs, and wireless transmitters, form bandpass filters, generate clock signals, and serve as the resonant element in metal detectors, induction heaters, and wireless charging.

About this simulation

This simulation numerically integrates the series LC circuit equation L·q'' + R·q' + q/C = 0, where q is the charge (coulombs, C) on the capacitor and q' = I is the current. Every animation frame advances the state with 8 sub-steps of the fourth-order Runge–Kutta (RK4) method for numerical stability. With resistance R = 0 the equation reduces to the ideal case q'' + q/(LC) = 0, a simple harmonic oscillator identical in form to a mass on a spring, oscillating at angular frequency ω = 1/√(LC). Raising R adds a drag term that bleeds energy away as heat, so the swings of charge and current decay exponentially instead of repeating forever.

🔬 What it shows

An animated capacitor (charge shown as a glowing +/- polarity on its plates), an inductor coil whose magnetic-field glow scales with current, moving dots around the wire loop that reveal current direction and speed, two energy bars for E_C = q²/(2C) and E_L = L·I²/2 trading height as energy sloshes between them, a live q(t)/I(t) waveform strip, and a small mass-on-spring drawing whose displacement mirrors the charge in real time.

🎮 How to use it

Drag the sliders for Inductance L (0.2-4 H), Capacitance C (0.2-4 F), initial charge q₀ (0.1-1.5), and Resistance R (0-2 Ω); any change resets the run to q=q₀, I=0. Pause/Play toggles the RK4 integration, Reset restarts from the current slider values, and the ? button opens a popup with the full equations and controls.

💡 Did you know?

The same q'' + q/(LC) = 0 equation is why old radios were "tuned" by turning a knob: the knob rotated a variable capacitor, changing C so that f = 1/(2π√(LC)) matched the carrier frequency of the desired broadcast station, making the LC tank resonate with it while rejecting the rest.

Frequently asked questions

How does the simulation actually solve the LC circuit equation?

It applies fourth-order Runge-Kutta (RK4) integration to the pair of first-order equations q' = I and I' = -(R·I + q/C)/L, taking 8 smaller sub-steps every animation frame so the update stays numerically stable even at the extreme ends of the L, C, and R sliders.

Why does turning up the Resistance slider make the oscillation die out?

R models real wire and coil losses that convert electrical energy into heat. In the RK4 update, the current's rate of change includes a term -R·I/L that opposes the motion, so each swing of charge and current loses a little energy; push R high enough and the circuit becomes overdamped, decaying to zero instead of ringing.

What do the moving dots on the rectangular wire represent?

They visualise conventional current flowing around the loop. Their direction flips with the sign of the current I, and their speed is drawn proportional to |I| relative to the slider-dependent scale maxI = q₀/√(LC), so a faster stream of dots means a larger instantaneous current.

Why is there a mass-on-spring drawing next to the circuit?

It illustrates the exact analogy behind the code: the charge q is mapped directly onto the spring's displacement, because both obey the same differential equation (m·x'' + k·x = 0 versus L·q'' + q/C = 0). Watching the spring stretch and compress in step with the capacitor's charge shows that the electrical and mechanical oscillators are solving identical maths.

What happens to the two energy bars (E_C and E_L) as the circuit oscillates?

They show the instantaneous split of stored energy between the capacitor's electric field, E_C = q²/(2C), and the inductor's magnetic field, E_L = L·I²/2. As the simulation runs the bars trade height: E_C peaks when the capacitor is fully charged and current is zero, E_L peaks a quarter-cycle later when current is maximum and charge is zero, and in the lossless case (R=0) their sum stays constant.