0% found this document useful (0 votes)
0 views22 pages

Exam Guide

The Exam Preparation Guide covers circuit simulation modules including RC, RL, and RLC circuits using MATLAB, Simulink, and PSpice. It provides essential formulas, MATLAB codes for circuit responses, and a quick reference for MATLAB commands and Simulink block diagrams. The guide also includes exercises and questions to aid in exam preparation.

Uploaded by

hichembs789
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)
0 views22 pages

Exam Guide

The Exam Preparation Guide covers circuit simulation modules including RC, RL, and RLC circuits using MATLAB, Simulink, and PSpice. It provides essential formulas, MATLAB codes for circuit responses, and a quick reference for MATLAB commands and Simulink block diagrams. The guide also includes exercises and questions to aid in exam preparation.

Uploaded by

hichembs789
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

EXAM PREPARATION GUIDE

Circuit Simulation Module


MATLAB · Simulink · PSpice · RC / RL / RLC Circuits

Contents: RC / RL / RLC Circuits with Graphs (DC + AC) ✦ MATLAB Commands &
Complete Codes
Simulink Block Diagrams ✦ PSpice Reference ✦ 50-Question QCM ✦ Error Spotting
Exercises
PART 1 — RC Circuit

1.1 What is an RC Circuit?


An RC circuit contains a Resistor (R) and a Capacitor (C) in series, powered by a voltage source.
The capacitor charges and discharges through the resistor, creating an exponential response in
time.

1.2 Key Formula: Time Constant


τ = R × C [seconds]
τ (tau) is the TIME CONSTANT. It tells you how fast the capacitor charges/discharges.

1.3 DC Response — Charging


V_C(t) = E × (1 − e^(−t/τ)) Charging formula
V_R(t) = E × e^(−t/τ) Voltage across resistor
i(t) = (E/R) × e^(−t/τ) Current

Key values to remember:


Time V_C value % of final value

t=τ V_C = 0.632 × E 63.2% ← Most important!

t = 2τ V_C = 0.865 × E 86.5%

t = 3τ V_C = 0.950 × E 95.0%

t = 5τ V_C ≈ E 99.3% ← Considered fully charged

1.4 DC Response — Discharging


V_C(t) = E × e^(−t/τ) Discharging formula
V_R(t) = −E × e^(−t/τ) (negative: current reverses)

■ Rule: V_C is ALWAYS continuous — it cannot jump instantaneously. Current CAN jump.

1.5 AC Response (Sinusoidal Source)


When the source is sinusoidal V_in = A·sin(ωt), the capacitor voltage depends on the ratio f·τ:
Condition Behavior V_C magnitude

f·τ << 1 (low freq) V_C follows V_in closely |V_C| ≈ |V_in|

f·τ = 1 (mid freq) V_C is attenuated & delayed |V_C| = |V_in|/√2 ≈ 0.707·|V_in|

f·τ >> 1 (high freq) V_C is strongly reduced |V_C| ≈ 0

|V_C| / |V_in| = 1 / √(1 + (ω·τ)²) Filter formula


1.6 DC Steady State Rules (very important for exam!)
Component At t = 0 (switch just closed) At t = ∞ (fully settled)

Capacitor C V_C = V_C(0) [initial value, often 0] V_C = E (fully charged)

Current i i = E/R (max current) i = 0 (no current through C)

V_R V_R = E (all voltage on R initially) V_R = 0

1.7 MATLAB Code — RC Circuit


DC Charging (analytical):
% === RC Circuit — DC Charging ===
R = 2000; % Resistance [Ω]
C = 1e-6; % Capacitance [F]
E = 10; % Source voltage [V]
tau = R * C; % Time constant τ = RC [s]
t = 0 : 1e-6 : 5*tau; % time vector, step = 1 µs
Vc = E * (1 - exp(-t ./ tau)); % capacitor voltage
Vr = E * exp(-t ./ tau); % resistor voltage
i = (E/R) * exp(-t ./ tau); % current [A]
figure(1);
plot(t*1e3, Vc, 'b', 'LineWidth', 2); % blue = Vc
hold on;
plot(t*1e3, Vr, 'r', 'LineWidth', 2); % red = Vr
plot(t*1e3, E*ones(size(t)), 'k--'); % dashed = E
hold off;
xlabel('Time [ms]');
ylabel('Voltage [V]');
title('RC Circuit — DC Charging Response');
legend('V_C', 'V_R', 'E');
grid on;

AC Sinusoidal (numerical — Euler method):


% === RC Circuit — AC Sinusoidal ===
R = 2000; C = 1e-6; A = 10; f = 50;
w = 2 * pi * f; % angular frequency ω [rad/s]
tau = R * C;
dt = 1e-6; % time step
t = 0 : dt : 4/f; % 4 full periods
Vin = A * sin(w * t); % sinusoidal source
Vc = zeros(1, length(t)); % initialise V_C = 0
for k = 1 : length(t)-1
dVc = (Vin(k) - Vc(k)) / tau; % dVc/dt = (Vin-Vc)/(RC)
Vc(k+1) = Vc(k) + dVc * dt;
end
plot(t*1e3, Vin, 'b', t*1e3, Vc, 'r--', 'LineWidth', 2);
xlabel('Time [ms]'); ylabel('Voltage [V]');
legend('V_{in}', 'V_C'); grid on;
PART 2 — RL Circuit

2.1 What is an RL Circuit?


An RL circuit contains a Resistor (R) and an Inductor (L). The inductor opposes changes in
current (Lenz's law). Current builds up exponentially, just like voltage in RC.

2.2 Key Formula: Time Constant


τ = L / R [seconds]
■ Rule: Current in an inductor is ALWAYS continuous — it cannot jump instantaneously. V_L CAN
jump.

2.3 DC Response — Current Build-up


i(t) = (E/R) × (1 − e^(−t/τ)) Current build-up
V_R(t) = E × (1 − e^(−t/τ)) Resistor voltage
V_L(t) = E × e^(−t/τ) Inductor voltage (starts at E, drops to 0)

2.4 DC Steady State


Component At t = 0 (switch just closed) At t = ∞ (fully settled)

Inductor L V_L = E (all voltage on L) V_L = 0 (inductor = short wire)

Current i i = 0 (inductor resists change) i = E/R (maximum)

V_R V_R = 0 (no current yet) V_R = E

2.5 RC vs RL Analogy
RC Circuit RL Circuit Meaning

V_C i Continuous quantity (cannot jump)

V_R V_R Follows the step/impulse

V_R V_L The "reactive" voltage

τ = RC τ = L/R Time constant formula

2.6 MATLAB Code — RL Circuit


% === RL Circuit — DC Response ===
R = 250; L = 0.11; E = 10;
tau = L / R; % τ = L/R
t = 0 : 1e-6 : 5*tau;
i_t = (E/R) * (1 - exp(-t./tau)); % current
Vr = R * i_t; % V_R = R·i
Vl = E - Vr; % V_L = E - V_R (Kirchhoff)
plot(t*1e3, Vr,'b', t*1e3, Vl,'r', t*1e3, i_t,'g--', 'LineWidth',2);
xlabel('Time [ms]'); ylabel('V / A');
legend('V_R','V_L','i(t)'); grid on;
PART 3 — RLC Circuit (2nd Order)

3.1 What is an RLC Circuit?


An RLC series circuit contains all three components. It is a 2nd-order system described by a
2nd-order differential equation. The behavior depends on the damping factor σ (sigma).

3.2 Key Parameters


ω■ = 1 / √(L·C) Natural (resonant) angular frequency [rad/s]
σ = R / (2·L·ω■) Damping ratio (dimensionless)
f■ = ω■ / (2π) Natural frequency [Hz]
Q = 1 / (2σ) = ω■·L/R Quality factor (higher Q = more oscillations)

3.3 The Three Damping Regimes


Regime Condition Behavior Graph shape

Under-damped σ < 1 (Q > 0.5) Oscillations that decay around E Damped sine wave

Critically damped σ = 1 (Q = 0.5) Fastest settling, no oscillation Fast exponential

Over-damped σ > 1 (Q < 0.5) Slow return, no oscillation Two slow


exponentials

Critical resistance: R_c = 2 × √(L/C)

3.4 State Equations (used in MATLAB and Simulink)


These two equations are the heart of any RLC simulation:
di/dt = (E − V_C − R·i) / L ← from Kirchhoff voltage law
dV_C/dt = i / C ← capacitor current-voltage relation

3.5 MATLAB Code — RLC Circuit (Euler Method)


% === RLC Series Circuit — DC Step Response ===
R = 250; % Resistance [Ω]
L = 0.11; % Inductance [H]
C = 0.44e-6; % Capacitance [F]
E = 10; % Source voltage [V]
dt = 1e-6; % Time step [s] (must be small!)
t = 0 : dt : 60e-3; % 0 to 60 ms
% Calculate key parameters
w0 = 1 / sqrt(L*C); % ω■ = natural frequency
sigma = R / (2*L*w0); % σ = damping ratio
fprintf("omega0 = %.1f rad/s, sigma = %.3f\n", w0, sigma);
% Initial conditions: V_C(0)=0, i(0)=0
Vc = zeros(1, length(t));
i = zeros(1, length(t));
% Euler numerical integration
for k = 1 : length(t)-1
di_dt = (E - Vc(k) - R*i(k)) / L; % state eq. 1
dVc_dt = i(k) / C; % state eq. 2
i(k+1) = i(k) + di_dt * dt;
Vc(k+1) = Vc(k) + dVc_dt * dt;
end
subplot(2,1,1);
plot(t*1e3, Vc, 'b', 'LineWidth', 2);
ylabel('V_C [V]'); grid on; title('RLC — V_C(t)');
subplot(2,1,2);
plot(t*1e3, i, 'r', 'LineWidth', 2);
ylabel('i [A]'); xlabel('Time [ms]'); grid on; title('RLC — i(t)');
PART 4 — MATLAB Quick Reference

4.1 Essential Commands


Command What it does Example

t = 0:dt:tf Create time vector with step dt t = 0:1e-6:0.01

linspace(a,b,n) n equally spaced points from a to b t = linspace(0,0.01,10000)

zeros(1,n) Vector of n zeros (initial conditions) Vc = zeros(1,length(t))

exp(x) Exponential e^x Vc = E*(1-exp(-t/tau))

sqrt(x) Square root w0 = 1/sqrt(L*C)

pi Value of π (3.14159...) w = 2*pi*f

sin(x) Sine (x in radians) Vin = A*sin(w*t)

length(v) Number of elements in vector v N = length(t)

ones(1,n) Vector of n ones E_line = E*ones(size(t))

plot(x,y) Plot y vs x plot(t, Vc)

plot(x,y,'r--') Red dashed line plot(t,Vc,'r--')

hold on Keep current graph, add more curves hold on

hold off Stop superimposing curves hold off

subplot(m,n,k) m×n grid, select plot k subplot(2,1,1)

xlabel(str) X-axis label xlabel('Time [ms]')

ylabel(str) Y-axis label ylabel('Voltage [V]')

title(str) Graph title title('RC Response')

legend(...) Add legend legend('Vc','Vr')

grid on Show grid lines grid on

clc Clear Command Window clc

clear Delete all workspace variables clear

fprintf Print formatted text fprintf('tau = %.3f\n', tau)

4.2 Plotting Tricks


% Multiple curves in one call:
plot(t, Vc, 'b-', t, Vr, 'r--', t, E_line, 'k:', 'LineWidth', 2)
% Axis labels with units and subscripts:
xlabel('Time [ms]')
ylabel('Voltage [V]')
title('RC Circuit — Step Response')
legend('V_C','V_R','E_{source}')
% Save figure as image:
saveas(gcf, 'my_circuit.png')
PART 5 — Simulink Block Diagram Reference

5.1 Launching Simulink


• Method 1: Type simulink in MATLAB Command Window → press Enter
• Method 2: Click the Simulink icon in the MATLAB toolbar
• Create new model: File → New → Model (or Ctrl+N)
• Access Configuration Parameters: Simulation → Configuration Parameters or Ctrl+E

5.2 Key Block Libraries


Library Block Name What it does Used for

Commonly Used Sum Adds or subtracts inputs (set signs V_in − V_C − V_R
+/−)

Commonly Used Gain Multiplies by a constant Multiply by 1/L or R

Commonly Used Integrator (1/s) Integrates signal over time di/dt → i, dVc/dt → Vc

Commonly Used Scope Displays signal waveform in Visualize Vc, i


real-time

Commonly Used Product Multiplies two input signals R × i = V_R

Math Ops Divide Divides two signals (A/B) Divide by L or C

Continuous Integrator More options (IC, limits) Set initial condition IC=0

Sources Sine Wave Generates A·sin(ω·t + φ) AC source

Sources Step Step from 0 to E at t=0 DC step source

Sources Constant Fixed value R, L, C values

Sources Clock Outputs current simulation time t Export time to


workspace

Sinks Scope Oscilloscope display View waveforms

Sinks To Workspace Saves data to MATLAB workspace Export for plot()

Sinks XY Graph Plots Y vs X (phase plane) Vc vs i

5.3 RLC Circuit Simulink Block Scheme


The Simulink model implements the two state equations:
di/dt = (1/L) × (V_in − V_C − R·i)
dV_C/dt = (1/C) × i

Blocks to place (in order of signal flow):


Step Block Setting Signal produced

1 Sine Wave (Sources) Amplitude=1, Freq=5e5 rad/s V_in


Step Block Setting Signal produced

2 Sum (Comm. Used) Signs: + − − (3 inputs) V_in − V_C − V_R

3 Gain Value: 1/L = 1/200e-6 = 5000 (V_in−V_C−V_R)/L = di/dt

4 Integrator Initial condition = 0 Current i(t)

5 Gain (R) Value: R = 70 V_R = R × i

6 Integrator Feed i into Gain(1/C) then Capacitor voltage V_C


integrate

7 Gain (1/C) Value: 1/C = 1/200e-12 i/C = dV_C/dt

8 Scope Connect i or V_C View waveform

9 To Workspace Variable: "courant", format: Array Export data

10 Clock → To Workspace Variable: "t" Export time

Tip: To flip a block direction: right-click → Format → Flip Block (or Ctrl+R)
Tip: Feedback loop: the V_C signal must loop back to the Sum block input with − sign

5.4 Lab TP1 Parameters (RLC series)


Parameter Value How to enter in Simulink

Source amplitude 1V Sine Wave block: Amplitude = 1

Source frequency f = 5×10■ Hz → ω = 2π×5e5 rad/s Sine Wave block: Frequency = 2*pi*5e5

Resistance R 70 Ω Gain block: Gain = 70

Inductance L 200 µH = 200e-6 H Gain block: Gain = 1/200e-6 (= 5000)

Capacitance C 200 pF = 200e-12 F Gain block: Gain = 1/200e-12

Stop time 0.00004 s = 40 µs Configuration Parameters → Stop time

Solver ODE45 (Dormand-Prince) Configuration Parameters → Solver

Relative tolerance 1e-3 Configuration Parameters → Rel.


tolerance

5.5 Exporting to MATLAB and Plotting


% After running the Simulink simulation:
% (courant and t are now in the MATLAB Workspace)
plot(t, courant, 'r', 'LineWidth', 2);
grid on;
xlabel('Time [s]');
ylabel('Current [A]');
title('RLC Circuit — Current vs Time');
PART 6 — PSpice Reference

6.1 What is PSpice?


PSpice is a circuit simulation program based on SPICE (Simulation Program with Integrated
Circuit Emphasis). It simulates circuits at the component level, using OrCAD Capture to draw
schematics and PSpice A/D to run the simulation.

6.2 PSpice vs MATLAB/Simulink


Feature PSpice MATLAB/Simulink

Approach Component-level (resistors, capacitors Equation-level (block diagrams or code)


drawn physically)

Schematic OrCAD Capture (drag & drop Simulink Library Browser


components)

Simulation PSpice A/D engine MATLAB ODE solvers (ode45 etc.)

Output viewer Probe (waveform viewer) Scope block or MATLAB plot()

Netlist format .cir or .net text file Not applicable (uses .slx model files)

Good for Real circuit design with real Control systems, signal processing, custom
component models equations

6.3 Simulation Workflow in PSpice


Step Action Details

1 Open OrCAD Capture File → New → Project

2 Place components Place → Part (or press P) → search component name

3 Connect wires Place → Wire (or press W)

4 Add ground Must place GND_EARTH (0V reference) — simulation FAILS


without it!

5 Set values Double-click component → edit Value property

6 Add probes Place voltage/current markers on wires

7 Create simulation profile PSpice → New Simulation Profile → choose analysis type

8 Configure analysis Set time range, frequency range, etc.

9 Run simulation PSpice → Run or F11

10 View results PSpice Probe window opens automatically

6.4 Analysis Types


Analysis Type Use it when... Key settings Equivalent MATLAB

Time Domain (Transient) You want V(t) or i(t) Run to time, Max step size Euler loop or ode45
response

AC Sweep You want frequency Start freq, End freq, bode(), freqs()
response / Bode pts/decade

DC Sweep You want DC operating Source, start, end, step Simple calculation
point vs source

Parametric Sweep Study effect of changing Parameter name & range for loop in MATLAB
R, L or C

Monte Carlo Statistical analysis with Number of runs, tolerance rand() simulations
tolerances %

6.5 Common Components in PSpice


Component PSpice name Key properties Example value

Resistor R Value in Ω R = 70

Capacitor C Value in F (use p, n, u, m prefixes) C = 200p (200 pF)

Inductor L Value in H L = 200u (200 µH)

DC voltage source VDC DC = value DC = 10

Sinusoidal source VSIN VOFF=0, VAMPL=amplitude, VAMPL=1,


FREQ=frequency FREQ=500000

AC source VAC AC magnitude, phase AC 1

Ground GND_EARTH Mandatory reference node Always needed!

■ Critical: PSpice requires at least ONE ground node (0V reference). Without it, the simulation will
fail to run.
PART 7 — Error Spotting & Correction Exercises
These exercises simulate what your professor might ask: find and fix the bugs in
MATLAB/Simulink code. There are always multiple errors per exercise.

Exercise 1 — RC Circuit — Time Constant Mistake


Buggy Code:
% RC charging circuit
R = 2000;
C = 1e-6;
E = 10;
tau = R / C; % LINE A
t = 0 : 1e6 : 5*tau; % LINE B
Vc = E * exp(-t/tau); % LINE C
plot(Vc, t); % LINE D

Errors Found & Corrections:


• Error 1: LINE A — tau = R / C is WRONG. Correct formula: tau = R * C (τ = RC = 2000 × 1e-6
= 0.002 s)
• Error 2: LINE B — Step size 1e6 is enormous (1 million). Must be t = 0 : 1e-6 : 5*tau
• Error 3: LINE C — exp(−t/tau) is the DISCHARGE formula. For charging: Vc = E * (1 -
exp(-t/tau))
• Error 4: LINE D — plot(Vc, t) plots voltage on X axis and time on Y axis (backwards!). Must be
plot(t, Vc)

Fixed Code:
% CORRECTED:
R = 2000; C = 1e-6; E = 10;
tau = R * C; % τ = RC ✓
t = 0 : 1e-6 : 5*tau; % small step ✓
Vc = E * (1 - exp(-t/tau)); % charging ✓
plot(t, Vc, 'b', 'LineWidth',2); % t on X axis ✓
xlabel('Time [s]'); ylabel('V_C [V]'); grid on;

Exercise 2 — RLC Circuit — Sign Errors in State Equations


Buggy Code:
% RLC circuit Euler integration
R=250; L=0.11; C=0.44e-6; E=10; dt=1e-6;
t = 0:dt:60e-3;
Vc = zeros(1,length(t));
i = zeros(1,length(t));
for k = 1:length(t)
di_dt = (E - Vc(k) + R*i(k)) / L; % LINE A
dVc_dt = i(k) * C; % LINE B
i(k+1) = i(k) + di_dt * dt;
Vc(k+1) = Vc(k) + dVc_dt * dt;
end
Errors Found & Corrections:
• Error 1: LINE A — (E − Vc + R·i) should be (E − Vc − R·i). Kirchhoff: E = Vc + V_R + V_L →
V_L = E−Vc−R·i. Using + instead of − adds instead of subtracts V_R (wrong physics!).
• Error 2: LINE B — i(k) * C is WRONG. The correct formula is dVc/dt = i/C → dVc_dt = i(k) / C
• Error 3: LINE for — for k = 1:length(t) will cause an index-out-of-bounds error when trying to
access k+1 at the last iteration. Must be for k = 1:length(t)-1

Fixed Code:
% CORRECTED:
for k = 1 : length(t)-1 % stop at N-1 ✓
di_dt = (E - Vc(k) - R*i(k)) / L; % minus sign ✓
dVc_dt = i(k) / C; % divide by C ✓
i(k+1) = i(k) + di_dt * dt;
Vc(k+1) = Vc(k) + dVc_dt * dt;
end

Exercise 3 — Plot Labels & Missing Grid


Buggy Code:
% RL circuit plot
R=250; L=0.11; E=10;
tau = L*R; % LINE A
t = 0:1e-6:5*tau;
i_t = (E/R)*(1-exp(-t/tau));
Vr = R*i_t;
Vl = E - Vr;
plot(t, i_t, 'g');
xlabel('i [A]'); % LINE B
ylabel('Time [ms]'); % LINE C
title('RLC Response'); % LINE D
grid off; % LINE E

Errors Found & Corrections:


• Error 1: LINE A — tau = L*R is WRONG. For RL circuits: τ = L/R (not L×R!)
• Error 2: LINE B — xlabel should be 'Time [s]' or 'Time [ms]' — X axis is time, not current
• Error 3: LINE C — ylabel should be 'Current [A]' or 'Voltage [V]' — Y axis is the signal
• Error 4: LINE D — 'RLC Response' is misleading for an RL circuit. Should say 'RL Circuit
Response'
• Error 5: LINE E — grid off disables the grid. Use grid on to show the grid (much more
readable)

Fixed Code:
% CORRECTED:
tau = L / R; % τ = L/R ✓
t = 0:1e-6:5*tau;
i_t = (E/R)*(1-exp(-t/tau));
plot(t*1e3, i_t, 'g', 'LineWidth', 2);
xlabel('Time [ms]'); % X = time ✓
ylabel('Current [A]'); % Y = current ✓
title('RL Circuit — Current Build-up'); ✓
grid on; % show grid ✓

Exercise 4 — Simulink Configuration — Wrong Parameters


Buggy Code:
% Student describes their Simulink setup:
% - Solver: ODE45 (Dormand-Prince)
% - Stop time: 0.04 seconds
% - Relative tolerance: 1 (default)
% - To Workspace block: Save format = Timeseries
% - Sine Wave block: Frequency = 500000 Hz
% Result: simulation runs but graph looks wrong

Errors Found & Corrections:


• Error 1: Relative tolerance = 1 is WAY too loose. This makes the solver take huge steps and
gives very inaccurate results. Should be 1e-3 (0.001) or smaller.
• Error 2: To Workspace 'Timeseries' format is harder to use in plot(). Should be 'Array' to get a
simple vector you can plot directly.
• Error 3: Sine Wave Frequency field in Simulink expects RADIANS/second (rad/s), not Hz. For
f=500000 Hz, enter: 2*pi*500000 (approximately 3.14e6 rad/s).

Fixed Code:
% Correct Simulink settings:
% - Relative tolerance: 1e-3
% - To Workspace format: Array
% - Sine Wave frequency: 2*pi*500000 (rad/s, not Hz!)
% - Stop time: depends on circuit (here ~40e-6 seconds for RLC TP)

Exercise 5 — Initialisation & Dimension Mismatch


Buggy Code:
% RLC simulation with initialisation errors
R=250; L=0.11; C=0.44e-6; E=10; dt=1e-6;
t = 0:dt:60e-3;
Vc = 0; % LINE A
i = zeros(length(t),1); % LINE B
for k = 1:length(t)-1
di_dt = (E-Vc(k)-R*i(k))/L;
dVc_dt = i(k)/C;
i(k+1) = i(k) + di_dt*dt;
Vc(k+1) = Vc(k) + dVc_dt*dt;
end
plot(t, Vc); % LINE C

Errors Found & Corrections:


• Error 1: LINE A — Vc = 0 initialises Vc as a scalar (1 number). Trying to assign Vc(k+1) will
fail because MATLAB cannot grow it automatically inside the loop without pre-allocation.
Use: Vc = zeros(1, length(t));
• Error 2: LINE B — zeros(length(t), 1) creates a COLUMN vector (N×1), but t is a ROW vector
(1×N). Dimension mismatch will cause errors. Use: i = zeros(1, length(t)); (row vector)
• Error 3: LINE C — plot(t, Vc) — if Vc ended up as wrong shape, this fails. Always check:
size(t) must equal size(Vc) before plotting.

Fixed Code:
% CORRECTED:
Vc = zeros(1, length(t)); % row vector, pre-allocated ✓
i = zeros(1, length(t)); % row vector, pre-allocated ✓
% ... Euler loop unchanged ...
% Before plotting, verify dimensions:
% size(t), size(Vc), size(i) should all be [1 × N]
plot(t*1e3, Vc, 'b', 'LineWidth',2); ✓
PART 8 — 50-Question Multiple Choice (QCM)
Each question has exactly ONE correct answer. Answers are at the end of this section.

Section A — RC Circuit Theory (Q1–Q10)


# Question A B C D ✓ Answer

1 What is the time constant of an RC A) 0.5 ms B) 2 ms C) 2000 s D) 0.002 B — τ=RC=10


circuit with R = 1000 Ω and C = 2 µs 00×2e-6=0.00
µF? 2s=2ms

2 At time t = τ, the capacitor voltage A) 36.8% B) 50% of C) 63.2% D) 86.5% C — 63.2%


during charging from 0 V equals: of E E of E of E (1−e■¹)

3 In DC steady state, a fully charged A) A short B) An C) A D) An B — open


capacitor behaves like: circuit open resistor R inductor circuit, i=0
circuit

4 During RC charging, which quantity A) Current B) Voltage C) Source D) D — V_C is


CANNOT jump instantaneously? i V_R voltage E Capacitor always
voltage continuous
V_C

5 What is the voltage across the A) 63.2% B) 86.5% C) 95.0% D) ≈ D — 99.3%,


capacitor at t = 5τ (charging from 0)? of E of E of E 99.3% of considered
E≈E fully charged

6 The RC discharge formula for V_C(t) A) E·(1−e^ B) C) E/(1+e^ D) E·(1+e^ B — E·e^(−t/τ)


is: (−t/τ)) E·e^(−t/τ) (−t/τ)) (−t/τ))

7 In an RC circuit with E=10V, R=2kΩ, A) 3.68 V B) 5.00 V C) 6.32 V D) 8.65 V C — 0.632×10


C=1µF: at t=τ during charging, V_C = = 6.32 V

8 The AC filter formula for the RC A) ω·τ B) C) 1/√(1+( D) C — |Vc/Vin| =


low-pass filter gain is: 1/(1+ω·τ) ω·τ)²) √(1+(ω·τ)²) 1/√(1+(ωτ)²)

9 At the cut-off frequency (f_c = A) 0.500 B) 0.632 C) 0.707 D) 1.000 C — 0.707 =


1/(2πτ)) of an RC filter, |V_C/V_in| = 1/√2

1 In an RC circuit, energy is dissipated A) The B) Both R C) The D) Neither C — only R


0 in: capacitor and C resistor componen dissipates
only only t (P=i²R)

Section B — RL Circuit Theory (Q11–Q20)


# Question A B C D ✓ Answer

1 What is the time constant of an RL A) 125 s B) 0.5 ms C) 200 ms D) 0.5 s B — τ=L/R=0.


1 circuit with R = 500 Ω and L = 0.25 25/500=5×10■
H? ■s=0.5ms

1 In an RL circuit, which quantity A) B) Current C) D) Applied B — current in


2 CANNOT jump instantaneously? Inductor i Resistor voltage E inductor is
voltage voltage continuous
V_L V_R
# Question A B C D ✓ Answer

1 In DC steady state, an inductor A) An B) A C) A short D) A C — V_L=0,


3 behaves like: open capacitor circuit resistor R behaves as
circuit (wire) wire

1 At t=0+ (switch just closed) in an RL A) 0 B) E/2 C) E/R D) E D — V_L=E


4 circuit with no initial current, V_L = (all voltage on
inductor
initially)

1 The energy stored in an inductor with A) L·I B) ½·L·I² C) L·I² D) ½·L/I² B — E_L =
5 current I is: ½LI²

1 The RL current build-up formula i(t) A) (E/R)·e B) E·(1−e^ C) (E/R)·( D) (E/L)·e^ C — (E/R)·(1−
6 is: ^(−t/τ) (−t/τ)) 1−e^(−t/τ)) (−t/τ) e^(−t/τ))

1 In RL, V_L(t) during current build-up A) E·(1−e^ B) C) (E/R)·e D) R·i(t) B — V_L =


7 equals: (−t/τ)) E·e^(−t/τ) ^(−t/τ) E·e^(−t/τ)
(decays from E
to 0)

1 An RL circuit with τ=2ms: at t=10ms A) 0 B) E/(2R) C) E/R × D) E/R (m D — at 5τ, i ≈


8 (=5τ), the current i equals 0.632 aximum) E/R (fully
approximately: established)

1 How does an RL circuit compare to A) They B) i in RL C) V_L in D) τ=L/R B — i(RL) is


9 RC? (analogy) have no ↔ V_C in RL ↔ V_C ↔ τ=C/R analogous to
analogy RC (both c in RC Vc(RC)
ontinuous
quantities)

2 In an RL circuit with E=12V, R=300Ω: A) 0 A B) 12 mA C) 40 mA D) 300 A C — I=E/R=12


0 the final steady-state current is: /300=0.04A=4
0mA

Section C — RLC Circuit Theory (Q21–Q30)


# Question A B C D ✓ Answer

2 An RLC circuit is described by a A) 1st B) 2nd C) 3rd D) Zero B — 2nd order


1 differential equation of order: order order order order
(algebraic)

2 The natural frequency ω■ of an RLC A) R/L B) 1/(RC) C) 1/√(LC) D) √(LC) C—


2 circuit equals: ω■=1/√(LC)

2 The damping ratio σ of an RLC A) R/(2L) B) C) D) B—


3 series circuit equals: R/(2Lω■) 1/(2RC) 2Lω■/R σ=R/(2Lω■)

2 Under-damped (oscillatory) A) σ > 1 B) σ = 1 C) σ < 1 D) σ = 0.5 C — σ<1 gives


4 behaviour occurs when: oscillating
response

2 The critical resistance R_c (boundary A) √(L/C) B) 2/√(LC) C) 2√(L/C) D) L/C C—


5 between oscillating & non-oscillating) Rc=2√(L/C)
is:
# Question A B C D ✓ Answer

2 For RLC with L=0.11H, C=0.44µF: A) 143 B) 4525 C) 45250 D) 143 B — ω■=1/√(0
6 ω■ ≈ rad/s rad/s rad/s krad/s .11×0.44e-6)≈
4525

2 The quality factor Q of a series RLC A) B) 2σ C) ω■L/R D) C — Q=ω■L/R


7 circuit is: R/(2Lω■) 1/ω■RC =1/(2σ)

2 At resonance in AC, the voltage A) Always B) Always C) Greater D) Zero C — |V_C|=Q×


8 across the capacitor can be: equal to less than than V_in |V_in| at
V_in V_in by factor resonance
Q

2 In a critically damped RLC (σ=1), the A) With B) Fastest C) Never D) Same B — fastest
9 circuit responds: slow oscill possible reaches as RC settling without
ations without os steady circuit oscillation
cillations state

3 The state equation dV_C/dt in an A) i × C B) i / C C) (E − D) B — dVc/dt =


0 RLC circuit equals: V_C)/L V_C/RC i/C

Section D — MATLAB Coding (Q31–40)


# Question A B C D ✓ Answer

3 Which MATLAB command creates a A) t = B) t = linsp C) t = 0:1e D) t = 0:0. C


1 time vector from 0 to 0.01s with step 0:1e6:0.01 ace(1e-6,0 -6:0.01 01:1e-6
1µs? .01)

3 What does 'hold on' do in MATLAB? A) B) Keeps C) Locks D) Saves B


2 Freezes current the axes the figure
all plot and limits
variables allows
adding
new
curves

3 The Euler method update for Vc is: A) dVc_dt B) dVc_dt C) dVc_dt D) dt / C — Vc(k+1) =
3 Vc(k+1) = Vc(k) + ? / dt × dt dVc_dt Vc(k) + dVc_dt
× dt

3 In the Euler loop 'for k = A) B) To C) To skip D) It is not B


4 1:length(t)-1', why subtract 1? MATLAB avoid the last necessary
loops start index k+1 sample
at 0 exceeding
array
length

3 Which command plots Vc in blue with A) plot(t,V B) plot(t,V C) plot(t,V D) draw(t, B


5 dashed line and width 2? c,'b',2) c,'b--','Line c,blue,das Vc,'b--',2)
Width',2) h)

3 To initialise Vc as a row vector of A) Vc = 0 B) Vc = ze C) Vc = ze D) Vc = nu C — row


6 zeros with same size as t, use: ros(length( ros(1,lengt ll(size(t)) vector [1 × N]
t),1) h(t))
# Question A B C D ✓ Answer

3 What does 'subplot(2,1,1)' do? A) Selects B) Creates C) Divides D) B


7 figure a 2-row, X-axis in 2 Creates 2
window 2 1-column separate
grid and figures
selects
position 1

3 The command fprintf("tau = %.3f\n", A) tau = B) tau = C) tau = D) tau = C — 3 decimal


8 tau) with tau=0.002 prints: 0.002000 2.000e-03 0.002 %.3f places

3 w = 2*pi*f with f=50 Hz gives ω = A) 100 B) 314.16 C) 50π D) Both B D — 2π×50=1


9 rad/s rad/s rad/s and C are 00π=314.16
correct rad/s

4 What is wrong with: Vc = E * A) Should B) Should C) Should D) Nothing B — exp(−t/τ)


0 exp(-t/tau) for charging? be use 1-exp( divide by is wrong gives
exp(+t/tau) -t/tau) R discharging,
not charging

Section E — Simulink & PSpice (Q41–50)


# Question A B C D ✓ Answer

4 In Simulink, which block performs the A) B) C) D) Gain C — Integrator


1 operation ∫ x·dt (integration over Derivative Transfer Integrator with 1/s
time)? Fcn (1/s)

4 The 'To Workspace' block in Simulink A) Timese B) C) Array D) CSV C — Array is


2 should have Save format set to: ries Structure easiest to use
with plot()

4 To flip a Simulink block horizontally A) Ctrl+F B) Ctrl+R C) Ctrl+H D) Ctrl+B B — Ctrl+R


3 (reverse signal flow), press: flips/rotates
block

4 In Simulink's Sine Wave block, the A) Hz B) kHz C) rad/s D) rpm C — rad/s (not
4 'Frequency' parameter must be (radians Hz!)
entered in: per
second)

4 The ODE45 solver in Simulink uses: A) Fixed B) C) Euler D) B — variable


5 step size Variable forward Backward step, 4th/5th
step size method Euler order
(adapts to Runge-Kutta
accuracy)

4 In PSpice, which analysis gives the A) AC B) DC C) Time D) Monte C — Transient


6 time-domain waveform V(t)? Sweep Sweep Domain (T Carlo analysis
ransient)

4 In PSpice, the VSIN source FREQ A) rad/s B) kHz C) Hz D) MHz C — Hz (unlike


7 parameter is entered in: Simulink which
uses rad/s)
# Question A B C D ✓ Answer

4 Why is a ground (GND_EARTH) A) It B) PSpice C) It D) It is not B — required


8 node REQUIRED in every PSpice provides needs a protects actually 0V reference
schematic? power to 0V the required
the circuit reference simulation
node to
solve
equations

4 In PSpice, 200pF is written as: A) B) 200pF C) 200p D) 0.2n C — PSpice


9 200e-12 uses 200p (SI
prefixes)

5 The main difference between A) B) PSpice C) D) They C


0 Simulink and PSpice is: Simulink is free, Simulink are
cannot Simulink is uses block identical
simulate paid /equation tools
circuits approach;
PSpice
uses com
ponent-lev
el SPICE
models

Answer Key Summary


Q Answer Q Answer Q Answer Q Answer Q Answer

1 B 11 B 21 B 31 C 41 C

2 C 12 B 22 C 32 B 42 C

3 B 13 C 23 B 33 C 43 B

4 D 14 D 24 C 34 B 44 C

5 D 15 B 25 C 35 B 45 B

6 B 16 C 26 B 36 C 46 C

7 C 17 B 27 C 37 B 47 C

8 C 18 D 28 C 38 C 48 B

9 C 19 B 29 B 39 D 49 C

10 C 20 C 30 B 40 B 50 C

Good luck on your exam! Study the formulas, practice the codes, and
understand the graphs.

You might also like