Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
S 14
QOD: How do phasors allow us to correctly model the basic component equations:
di dv
v = iR , v = L , and i = C ?
dt dt
1. a) Write an expression for vL(t > 0) for the circuit shown below. Hint: the L looks
like an open circuit for t = 0 and a wire for t -> ∞. Also, τ = L/R for an inductor.
b) Correct the MATLAB code below to plot your v(t) versus t from part (a).
vs = 2; % vs = 2 V
R = 10; % R = 10 ohms
L = 100e-3; % L = 100 mH
tau = L/R; % Time constant = L/R
2. a) Modify the MATLAB code below to create a function that calculates the phasor
for the sum of two sinusoids represented by phasors.
function [A3,phi3] = PhasorAdd(A1,phi1,A2,phi2)
% Usage [A3,phi3] = PhasorAdd(A1,phi1,A2,phi2)
% Calculates the phasor for the sum of two phasors.
% A1, phi1 = magnitude and phase shift in radians of 1st sine
wave (note the 1st phase is "phi one" (not phi el))
% A2, phi2 = magnitude and phase shift in radians of 2nd sine
wave
% A3, phi3 = magnitude and phase shift of sum of sinusoids
% Calculate the phasor sum. Not quite right--fix it!
phasor_sum = A1*e^(j*phi1) + A2*e^(j*phi2);
end
b) Use the function from part (a) to calculate the sum of the following two sinusoids.
Add code to also plot the resulting sinusoid.
6 cos(200π t + 60°) + 8 cos(200π t − 30°)
3. a) Patch up the MATLAB code below to create a function that calculates parallel
impedance. (The code is the same for resistance and impedance.)
function Ztot = Zpar(Zvec)
% Usage Ztot = Zpar(Zvec)
% Calculates the parallel impedance of the values in Zvec
b) Use addition and your function from part (a) to find the numerical value of the
total impedance of the circuit shown below. You will need to convert from L and
C values to impedances first. Note that ω = 1 krad/s.
4. a) Write the node-voltage equations for nodes A and B in the circuit shown below.
b) Rewrite the node-voltage equations from part (a) in matrix form. That is, write
MATLAB code similar in flavor to the code below to create a matrix equation for
the circuit in part (a).
% Example code for putting node-V equations in matrix form for
% some circuit, (not the same circuit as in part (a)!).
c) Use MATLAB to solve for the node voltages, as in the code below:
% Solve for vA and vB
v_vec = inv(A)*i_vec