辅导案例-ENG104

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
ENG104 MATLAB Assignment
Due 5pm 4/10/19
1. Consider the RL circuit shown in Figure 1.
(a) [1 mark] Determine an ODE for the current i flowing through the inductor.
(b) [1 marks] Approximate the derivative as
di
dt
∼= i(t+ δt)− i(t)
δt
to get a recursive equation for i(t+ δt) in terms of i(t).
(c) [2 marks] Write a MATLAB script RLPlotter1c that uses the result of 1(b) to compute and plot
i for t ∈ [0, T ]. Use values of R = 1 Ω, L = 2 H, T = 10 s, Vs = 10 V, i(0) = 0 A, and δt = 0.1 s.
Ensure that the axis labels are labeled.
(d) [2 marks] Write a MALTAB function RLSolver that takes six inputs and returns two outputs.
The inputs should be the values of R, L, T , Vs, i(0), and δt. The first output should be a vector
containing the values of t and the second output should be a vector containing the corresponding
values of i(t). (You should be able to reuse code from the previous question for this).
(e) [2 marks] Write a MATLAB script RLPlotter1e that makes use of RLSolver to produce a plot
showing i(t) for δt = 0.01 s, δt = 0.1 s, and δt = 1 s (all other parameters are as given in 1(c)).
Ensure the plot contains axis labels as well as a legend.
(f) [2 marks] Write a MATLAB script RLPlotter1f that makes use of RLSolver to produce a plot
showing i(t) for all four possible combinations of R = 1 Ω or R = 2 Ω and L = 1 H or L = 2 H (all
other parameters are as given in 1(c)). Ensure the plot contains axis labels as well as a legend.

+
Vs
R
i
L
Figure 1: RL circuit.
1
2. Now consider the RLC circuit shown in Figure 2.
(a) [2 marks] Determine an ODE for the current i flowing through the inductor.
(b) [1 marks] Make the substitution ψ(t) = didt to convert the second order ODE into a pair of single
order ODEs.
(c) [2 marks] Approximate the derivatives as
di
dt
∼= i(t+ δt)− i(t)
δt
,

dt
∼= ψ(t+ δt)− ψ(t)
δt
to get a pair of recursive equations for i(t+ δt) and ψ(t+ δt) in terms of i(t) and ψ(t).
(d) [3 marks] Write a MATLAB function RLCSolver that takes eight inputs and returns two outputs.
The inputs should be the values of R, L, C, T , Vs, i(0), ψ(0), and δt. The first output should
be a vector containing the values of t and the second output should be a vector containing the
corresponding values of i(t).
(e) [2 marks] Write a MATLAB script RLCPlotter2e that makes use of RLCSolver to produce a plot
showing i(t) for C = 1 F, T = 20 s, Vs = 10 V, i(0) = 0 A, ψ(0) = 0 As
−1
, δt = 0.1 s and all four
possible combinations of R = 1 Ω or R = 2 Ω and L = 1 H or L = 2 H. Ensure the plot contains
axis labels as well as a legend. Note that the current should converge to the same value as in the
RL circuit for t→∞.

+
Vs
R
i
L
C
Figure 2: RLC circuit.
Submission guidelines
• Your MATLAB scripts and functions should all be different files (please use the suggested names).
• Your answers to 1(a), 1(b), 2(a), 2(b), and 2(c) can either be in a single file or multiple files. Typed or
scanned handwritten answers are both fine.
• Include all files in a single zip file and submit on MyLO. Please include your name and student number
in the name of the zip file.
2
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468