Circuit Fundamentals
Master voltage, current, resistance, and reactive components — with live calculators, waveform visualizers, and GNU Octave code you can run immediately.
Fundamental Quantities
Every electric circuit can be described by three core quantities: Voltage, Current, and Resistance. Understanding what they represent physically is the foundation of all circuit analysis.
| Quantity | Symbol | Unit | Physical Meaning | Water Analogy |
|---|---|---|---|---|
| Voltage (EMF) | V | Volt (V) | Electric potential difference — the "push" that drives charge | Water pressure in a pipe |
| Current | I | Ampere (A) | Flow rate of electric charge (1 A = 1 Coulomb/second) | Volume of water flowing per second |
| Resistance | R | Ohm (Ω) | Opposition to current flow; converts electrical energy to heat | Pipe narrowness or friction |
| Charge | Q | Coulomb (C) | Fundamental quantity — Q = I × t | Total volume of water |
| Capacitance | C | Farad (F) | Ability to store charge; Q = C × V | Tank that stores water |
| Inductance | L | Henry (H) | Opposition to change in current; stores energy in a magnetic field | Flywheel / water hammer |
% ── Basic Electrical Quantities in GNU Octave ────────────────── % Run in Octave: octave --persist basics.m % Define basic quantities V = 12; % Voltage in Volts I = 2; % Current in Amperes R = V / I; % Resistance in Ohms (= 6 Ω) Q = I * 60; % Charge in Coulombs over 60 seconds printf("Voltage: %.2f V\n", V); printf("Current: %.2f A\n", I); printf("Resistance: %.2f Ohm\n", R); printf("Charge (60s):%.2f C\n", Q); % Plot V-I characteristic of a 6 Ω resistor V_range = linspace(0, 24, 100); I_range = V_range / R; figure(1); clf; plot(V_range, I_range, 'g-', 'LineWidth', 2); xlabel('Voltage (V)'); ylabel('Current (A)'); title('V-I Characteristic: 6Ω Resistor'); grid on;
Ohm's Law
Ohm's Law is the most fundamental relationship in circuit analysis. It states that the voltage across a resistor is directly proportional to the current flowing through it, with resistance as the constant of proportionality.
Enter any TWO values — the third is calculated automatically.
The slope of the V-I line is always 1/R. A steeper slope means lower resistance (more current for the same voltage).
% ── Ohm's Law — V-I curves for multiple resistors ──────────────── R_vals = [10, 50, 100, 470, 1000]; % Ohms V = linspace(0, 12, 200); % 0–12 V colors = {'g','c','y','m','r'}; figure(1); clf; hold on; for k = 1:length(R_vals) I = V / R_vals(k); plot(V, I * 1000, colors{k}, 'LineWidth', 2); % mA end legend(arrayfun(@(r) sprintf('%d Ω',r), R_vals, 'UniformOutput',false)); xlabel('Voltage (V)'); ylabel('Current (mA)'); title("Ohm's Law: V-I Characteristics"); grid on; % Quick solve: unknown resistance V_meas = 9.3; % measured voltage I_meas = 0.019; % measured current (19 mA) R_unknown = V_meas / I_meas; printf("Unknown R = %.1f Ω (nearest std: 470 Ω)\n", R_unknown);
Series & Parallel Circuits
Resistors (and other components) can be connected in series, parallel, or combinations of both. Each configuration has distinct properties for current and voltage distribution.
- Same current through all components
- Voltages add up to supply voltage
- Total R always greater than any single R
- One break opens the whole circuit
- Same voltage across all branches
- Currents add up to total current
- Total R always less than smallest R
- One break doesn't kill other branches
SERIES CIRCUIT
PARALLEL CIRCUIT
A voltage divider uses two resistors to produce a fraction of the supply voltage: V_out = V_in × R2 / (R1+R2)
% ── Series and Parallel Resistor Analysis ──────────────────────── R = [100, 220, 470]; % Resistor values in Ohms Vs = 12; % Supply voltage %% Series combination R_series = sum(R); I_series = Vs / R_series; V_drops = I_series * R; % voltage across each printf("=== SERIES ===\n"); printf("R_total = %.1f Ω\n", R_series); printf("Current = %.4f A = %.2f mA\n", I_series, I_series*1000); for k = 1:length(R) printf(" V_R%d = %.2f V\n", k, V_drops(k)); end %% Parallel combination R_parallel = 1 / sum(1 ./ R); I_total = Vs / R_parallel; I_branches = Vs ./ R; % current through each branch printf("\n=== PARALLEL ===\n"); printf("R_total = %.2f Ω\n", R_parallel); printf("I_total = %.4f A = %.2f mA\n", I_total, I_total*1000); for k = 1:length(R) printf(" I_R%d = %.2f mA\n", k, I_branches(k)*1000); end %% Voltage Divider R1 = 10000; R2 = 5600; Vout = Vs * R2 / (R1 + R2); printf("\nVoltage Divider: Vout = %.3f V (%.1f%%)\n", Vout, Vout/Vs*100);
Kirchhoff's Laws
Kirchhoff's laws generalize Ohm's Law for complex multi-loop, multi-source circuits. They derive from conservation of energy (KVL) and conservation of charge (KCL).
At any junction (node), the sum of currents entering equals the sum leaving. Charge cannot accumulate at a node.
The sum of all voltage rises and drops around any closed loop equals zero. Energy is conserved over a complete loop.
Adjust currents I1, I2 into a node. KCL forces I3 = I1 + I2 out.
% ── KVL via Matrix (Mesh Analysis) ─────────────────────────────── % % Two-mesh circuit: % % +Vs1─R1──A──R3──B──R2─+Vs2 % | | % GND GND % % Mesh 1: I1 through R1, R3 % Mesh 2: I2 through R2, R3 (shared, opposite direction) % % KVL Mesh 1: Vs1 = R1*I1 + R3*(I1-I2) % KVL Mesh 2: Vs2 = R2*I2 + R3*(I2-I1) Vs1 = 12; Vs2 = 6; R1 = 100; R2 = 200; R3 = 150; % Matrix form: [A]{I} = {b} A = [R1+R3, -R3; -R3, R2+R3]; b = [Vs1; Vs2]; I_mesh = A \ b; % Solve system of linear equations I1 = I_mesh(1); I2 = I_mesh(2); I_R3 = I1 - I2; % current through shared resistor printf("Mesh 1 current: %.4f A = %.2f mA\n", I1, I1*1000); printf("Mesh 2 current: %.4f A = %.2f mA\n", I2, I2*1000); printf("Current in R3: %.4f A = %.2f mA\n", I_R3, I_R3*1000); % Verify KVL for mesh 1 KVL1 = Vs1 - R1*I1 - R3*I_R3; printf("KVL check (should be ~0): %.6f\n", KVL1);
Capacitors & RC Circuits
A capacitor stores electric charge and energy in an electric field between two conductive plates separated by an insulating material (dielectric). It opposes sudden changes in voltage — exactly dual to a resistor opposing current.
When a capacitor charges through a resistor (RC circuit), the voltage follows an exponential curve defined by the time constant τ = RC. After 5τ, the capacitor is considered fully charged (99.3%).
| Time | Charging V_C | Discharging V_C |
|---|---|---|
| t = 0 | 0 V | V₀ |
| t = τ | 63.2% of Vs | 36.8% of V₀ |
| t = 2τ | 86.5% | 13.5% |
| t = 3τ | 95.0% | 5.0% |
| t = 5τ | 99.3% (≈ full) | 0.7% (≈ zero) |
% ── RC Charging and Discharging Curves ─────────────────────────── R = 10e3; % 10 kΩ C = 10e-6; % 10 µF Vs = 12; % Supply voltage V0 = 0; % initial capacitor voltage tau = R * C; % time constant in seconds t = linspace(0, 5*tau, 500); % Charging equation: V_C(t) = Vs * (1 - e^(-t/τ)) V_charge = Vs * (1 - exp(-t / tau)); % Discharging from Vs: V_C(t) = Vs * e^(-t/τ) V_discharge = Vs * exp(-t / tau); % Capacitor current during charging: i = (Vs/R) * e^(-t/τ) I_charge = (Vs / R) * exp(-t / tau); figure(1); clf; subplot(2,1,1); plot(t*1000, V_charge, 'g-', 'LineWidth',2); hold on; plot(t*1000, V_discharge, 'r--','LineWidth',2); xline(tau*1000, '--y'); % mark τ xlabel('Time (ms)'); ylabel('Voltage (V)'); legend('Charging','Discharging','\tau'); grid on; title(sprintf('RC Circuit τ = %.1f ms', tau*1000)); subplot(2,1,2); plot(t*1000, I_charge*1000, 'c-','LineWidth',2); xlabel('Time (ms)'); ylabel('Current (mA)'); title('Charging Current'); grid on;
Inductors & RL Circuits
An inductor stores energy in a magnetic field. It opposes changes in current (dual to a capacitor opposing changes in voltage). A coil of wire is the simplest inductor — its inductance depends on turns, geometry, and core material.
% ── RL Circuit — Current Rise and Fall ─────────────────────────── L = 100e-3; % 100 mH R = 50; % 50 Ω Vs = 12; % volts tau = L / R; % time constant I_inf = Vs / R; % steady-state current t = linspace(0, 5*tau, 500); % Current rise: I(t) = I_inf * (1 - e^(-t/τ)) I_rise = I_inf * (1 - exp(-t / tau)); % Voltage across inductor: V_L = Vs * e^(-t/τ) V_L = Vs * exp(-t / tau); % Voltage across resistor: V_R = Vs * (1 - e^(-t/τ)) V_R = Vs * (1 - exp(-t / tau)); figure(1); clf; subplot(2,1,1); plot(t*1000, I_rise*1000, 'g-', 'LineWidth',2); xlabel('Time (ms)'); ylabel('Current (mA)'); title(sprintf('RL Circuit — τ = %.3f ms', tau*1000)); grid on; subplot(2,1,2); plot(t*1000, V_L, 'm-', 'LineWidth',2); hold on; plot(t*1000, V_R, 'c--','LineWidth',2); legend('V_L', 'V_R'); grid on; xlabel('Time (ms)'); ylabel('Voltage (V)');
AC Signals & Impedance
Alternating Current (AC) oscillates sinusoidally in time. Instead of resistance, AC circuits use impedance Z (complex-valued), which combines resistance with reactance — the frequency-dependent opposition from capacitors and inductors.
| Element | Impedance Z | Behaviour at low f | Behaviour at high f |
|---|---|---|---|
| Resistor R | R (real, constant) | Same | Same |
| Capacitor C | 1 / (j·2πfC) | Open circuit (blocks DC) | Short circuit |
| Inductor L | j·2πfL | Short circuit (wire) | Open circuit |
An RC low-pass filter passes low frequencies and attenuates high ones. The cutoff frequency is f_c = 1/(2πRC) where gain = −3 dB.
% ── AC Analysis & RC Low-Pass Filter ───────────────────────────── %% Generate a sine wave f = 60; Vpk = 170; % 60 Hz mains, 170 Vpk (≈120 Vrms) Vrms = Vpk / sqrt(2); t = linspace(0, 3/60, 1000); % 3 cycles v = Vpk * sin(2*pi*f*t); printf("60 Hz: Vpk=%.0fV Vrms=%.1fV T=%.2fms\n",Vpk,Vrms,1/f*1000); %% RC Low-Pass Filter Bode Plot R = 10e3; C = 100e-9; fc = 1 / (2*pi*R*C); % cutoff frequency f_sweep = logspace(log10(10), log10(1e6), 500); % Transfer function H(jω) = 1 / (1 + jωRC) H = 1 ./ (1 + 1j*2*pi*f_sweep*R*C); gain_dB = 20*log10(abs(H)); phase_deg = angle(H) * 180/pi; figure(2); clf; subplot(2,1,1); semilogx(f_sweep, gain_dB, 'g-', 'LineWidth',2); hold on; xline(fc,'--y'); yline(-3,'--r'); xlabel('Frequency (Hz)'); ylabel('Gain (dB)'); title(sprintf('RC Low-Pass fc=%.0f Hz',fc)); grid on; subplot(2,1,2); semilogx(f_sweep, phase_deg, 'm-', 'LineWidth',2); xlabel('Frequency (Hz)'); ylabel('Phase (°)'); title('Phase Response'); grid on;
Electrical Power
Power is the rate of energy transfer. In electrical circuits, power can be dissipated (resistors → heat), stored (capacitors, inductors), or delivered (to a load).
| Quantity | Symbol | Unit | Description |
|---|---|---|---|
| Real Power | P | Watt (W) | Actual power dissipated/consumed (cosφ component) |
| Reactive Power | Q | VAR | Power stored and returned by L & C (sinφ component) |
| Apparent Power | S | VA | S = V × I = √(P² + Q²) |
| Power Factor | PF | 0–1 | PF = P/S = cosφ. PF=1 is ideal (pure resistive) |
% ── Power in DC and AC Circuits ─────────────────────────────────── %% DC Power V_dc = 12; I_dc = 2; R_dc = V_dc / I_dc; P_dc = V_dc * I_dc; printf("DC: P = %.1f W (= I²R = %.1f W = V²/R = %.1f W)\n", ... P_dc, I_dc^2*R_dc, V_dc^2/R_dc); %% AC Power with power factor Vrms = 120; Irms = 5; phi = 30; % degrees lag PF = cos(phi * pi/180); P_real = Vrms * Irms * PF; % Real power (W) Q_reactive = Vrms * Irms * sin(phi*pi/180); % Reactive (VAR) S_apparent = Vrms * Irms; % Apparent (VA) printf("\n=== AC Power (120 Vrms, 5 A, φ=30°) ===\n"); printf("Power Factor: PF = %.3f\n", PF); printf("Real Power: P = %.1f W\n", P_real); printf("Reactive Power: Q = %.1f VAR\n",Q_reactive); printf("Apparent Power: S = %.1f VA\n", S_apparent); printf("Check: sqrt(P²+Q²) = %.1f VA\n", sqrt(P_real^2+Q_reactive^2)); %% Power in a resistor over time R = 100; I_sweep = linspace(0, 1, 200); % 0 to 1 A P_sweep = I_sweep.^2 * R; % P = I²R figure(1); clf; plot(I_sweep*1000, P_sweep, 'g-', 'LineWidth', 2); xlabel('Current (mA)'); ylabel('Power (W)'); title('P = I²R — Quadratic Relationship'); grid on;
Resistors (E24): 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 Ω (×10ⁿ)
Capacitors: 100 pF, 1 nF, 10 nF, 100 nF (0.1 µF), 1 µF, 10 µF, 100 µF
Inductors: 1 µH – 10 mH common in RF; 100 mH – 10 H in power supplies