In: Electrical Engineering
(a) Chau’s electric circuit is a simple electronic circuit that can exhibit chaotic behaviour. The voltages x(t) and y(t), and current z(t), across components in the circuit can be investigated using the Matlab command
[t,xyz] = ode45(@ChuaFunction,[-10 100],[0.7 0.2 0.3]);
and the function:
1 function dxyzdt = ChuaFunction(~,xyz)
2 % xyz(1) = X, xyz(2) = Y, xyz(3) = Z
3 4 dxdt = 15.6*(xyz(2) - xyz(1) + 2*tanh(xyz(1)));
5 dydt = xyz(1) - xyz(2) + xyz(3);
6 dzdt = -28*xyz(2); 7
8 dxyzdt = [dxdt dydt dzdt]’;
9 end
(i) What is the differential equation involving x˙(t)? Here a dot represents differentiation with respect to time t.
(ii) What is the initial condition for the variable y(t)?
(iii) What does the apostrophe after the square brackets in line 8 of the function signify and why is the apostrophe needed here?
(b) For a given function u(t), explain how the derivative of u(t) with respect to t can be approximated on a uniform grid with grid spacing ∆t, using the one-sided forward difference approximation
du/dt ≈ Ui+1 − Ui/ ∆t ,
where ui = u(ti). You should include a suitable diagram explaining your answer
(c) Using the one-sided forward difference approximation from part (b) and Euler’s method, calculate the approximate solution to the initial value problem
du/dt + t cos(u) = 0, subject to u(0) = −0.2,
at t = 0.4, on a uniform grid with spacing ∆t = 0.1.
a)
i) In ChuaFunction dxyzdt = [ dxdt dydt dzdt ] ' is the vector containing derivatives of x, y, and z respectively.
dxdt is the derivative of x. It is defined in line 4 of the function code.
x˙(t) = 15.6*(xyz(2) - xyz(1) + 2*tanh(xyz(1)))
ii) MATLAB function ode45() is used to solve differential equations.
General syntax : [t,y] = ode45(odefun,tspan,y0)
y0 is the initial condition
In this problem [0.7 0.2 0.3] is the initial condition vector of the state vector y = [x(t) y(t) z(t)]
Hence x(0) = 0.7
iii) The vector of derivatives returned should be column vector for ode45 function
[dxdt dydt dzdt] is a row vector.
By adding an apostrophe we get the transpose [dxdt dydt dzdt]' which is a column vector
b)
Derivative of a function at any point t is the slope of the tangent to the cuve of function at that point. In this case we are approximating the slope at ti by assuming that function is linear in the interval delta_t. If ∆t is sufficiently small this approximation will be very accurate. And actual derivative is the limit of this slope when ∆t tends to zero.
du/dt at ti ≈ (Ui+1 − Ui) / ∆t
Since we are taking next point Ui+1 to find the slope at ti this is called Forward difference method.
If we take the previous point Ui-1 to approximate slope at ti then it will be called backward difference method.
c)
du/dt + t cos(u) = 0
Use the forward difference approximation for du/dt
Ui = u(ti) ( value of u at time ti)
(Ui+1 − Ui) / ∆t + ti cos(Ui) =0
Ui+1 = Ui - ∆t * ti cos(Ui)
U(0) = -0.2
∆t = 0.1
We can find U(0.4) by proceeding iteratively,
U(0.1) = U(0) - 0.1* 0*cos(U(0)) = -0.2
U(0.2) = U(0.1)- 0.1*0.1*cos(U(1)) = -0.2098
U(0.3) = U(0.2) - 0.1*0.2*cos( U(0.2) ) = -0.2294
U(0.4)= U(0.3) - 0.1*0.3*cos( U(0.3) ) = -0.2586