0% found this document useful (0 votes)
15 views1 page

Trans RL

The document describes a MATLAB function that simulates the transient response of a series RLC circuit to a step input voltage using Euler's method. It defines circuit parameters such as resistance, inductance, and capacitance, and initializes variables for current, charge, and capacitor voltage. The simulation results are plotted to show the current and capacitor voltage over time, illustrating the circuit's behavior based on its R, L, and C values.

Uploaded by

copeyic220
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)
15 views1 page

Trans RL

The document describes a MATLAB function that simulates the transient response of a series RLC circuit to a step input voltage using Euler's method. It defines circuit parameters such as resistance, inductance, and capacitance, and initializes variables for current, charge, and capacitor voltage. The simulation results are plotted to show the current and capacitor voltage over time, illustrating the circuit's behavior based on its R, L, and C values.

Uploaded by

copeyic220
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/ 1

function rlc_transient() % rlc_transient() simulates the transient response of a series RLC circuit % to a step input

voltage.

% Define circuit parameters R = 10; % Resistance (Ohms) L = 0.1; % Inductance (Henries) C = 1e-4; % Capacitance
(Farads) V_step = 5; % Amplitude of the step input voltage (V)

% Define simulation parameters t_start = 0; t_end = 0.1; dt = 1e-5; t = t_start:dt:t_end; num_steps = length(t);

% Initialize variables i = zeros(num_steps, 1); % Current in the circuit (A) q = zeros(num_steps, 1); % Charge on the
capacitor (C) vc = zeros(num_steps, 1); % Voltage across the capacitor (V)

% Initial conditions (at t=0) i(1) = 0; q(1) = 0; vc(1) = 0;

% Simulation loop using Euler's method for n = 1:num_steps - 1 % Apply Kirchhoff's Voltage Law (KVL): V_in - V_R - V_L
- V_C = 0 % V_R = i * R % V_L = L * di/dt => di/dt = (V_in - i*R - vc) / L % i = dq/dt => dq = i * dt => q(n+1) = q(n) +
i(n) * dt % vc = q / C

di_dt = (V_step - i(n) * R - vc(n)) / L;


dq_dt = i(n);

i(n+1) = i(n) + di_dt * dt;


q(n+1) = q(n) + dq_dt * dt;
vc(n+1) = q(n+1) / C;

end

% Plot the results figure; subplot(2, 1, 1); plot(t, i(1:num_steps-1)); xlabel('Time (s)'); ylabel('Current (A)');
title('Transient Response of Series RLC Circuit (Current)'); grid on;

subplot(2, 1, 2); plot(t, vc(1:num_steps-1)); xlabel('Time (s)'); ylabel('Capacitor Voltage (V)'); title('Transient Response of
Series RLC Circuit (Capacitor Voltage)'); grid on;

% Theory: This code simulates the transient behavior of a series RLC circuit % when subjected to a step input voltage.
Transient analysis is crucial for % understanding how circuits respond to sudden changes in input. The behavior % of
the RLC circuit is governed by a second-order linear differential equation % derived from Kirchhoff's Voltage Law (KVL)
and the voltage-current % relationships of resistors (V=IR), inductors (V=L di/dt), and capacitors % (i=C dv/dt or v =
1/C ∫i dt). The simulation uses Euler's method, a simple % numerical integration technique, to approximate the time
evolution of the % current and capacitor voltage. The transient response can exhibit oscillations % (underdamped),
critically damped behavior, or overdamped behavior depending % on the values of R, L, and C.

You might also like