Question: MATLAB CODE FOR PART 1 In this lab you will use the computer to solve 2-dimensional systems of ordinary differential equations, plot the solutions, and
MATLAB CODE FOR PART 1
In this lab you will use the computer to solve 2-dimensional systems of ordinary differential equations, plot the solutions, and determine the type and stability of their fixed points. Numerical methods are systematic ways of discretizing time and approximating the solution x(t) to a differential equation dx/dt = f(x), subject to the condition x = x0 at t = t0. Imagine a fluid particle flowing along the x-axis, with velocity f(x) at the location x. For a particle starting at x0, the local velocity is f(x0). If we flow for a short time t, well have moved approximately a distance f(x0)t, because distance = rate time. This is not exactly correct because the velocity was changing a little bit as x itself changes throughout t. However over a sufficiently small time step, the velocity is nearly constant and the approximation is reasonably good. The new position x(t0 + t) is approximately x0+f(x0)t. Call this approximation x1 and now iterate. Since our new location is x1, our new velocity is f(x1), and we step forward to x2 = x1 + f(x1)t, and so on. In general, the update rule is xn+1 = xn + f(xn)t Hopefully you recognize this as a difference equation. It is also the simplest possible numerical integration scheme for solving ODEs, and is called the forward Euler method (http://mathworld.wolfram.com/EulerForwardMethod.html). The Euler method is only first-order accurate, meaning that the error E is proportional to t, i.e. E t. So while E 0 as t 0 for the Euler method, the error decreases more quickly for higher-order methods such as the second-order (E (t) 2 ) Runge-Kutta method (http://mathworld.wolfram. com/Runge-KuttaMethod.html). It is straightforward to code up Runge-Kutta methods in MATLAB yourself, however there are also built-in ODE solvers that are accurate and easy to use. In this lab we will use the MATLAB solver ode45 (https://www.mathworks.com/help/matlab/ref/ode45.html).
Part 1: Numerically solve 2-D systems of linear ODEs In class on Tuesday we learned how to determine the type and stability of fixed points for 2-D nonlinear systems of ODEs by linearizing the model and computing the trace and determinant of the Jacobian matrix evaluated at the fixed points (x , y ). In this lab we will work with linear systems of the form: dx dt = ax + by dy dt = cx + d which can also be written in matrix form: dX dt = AX where X = (x, y) is a 2-dimensional vector and A = [a b; c d] is a 2 2 matrix. The trace and determinant of the matrix A give the type and stability of the fixed point (x , y ) = (0, 0) at the origin of the linear system.
For the following values of a, b, c, and d, make three plots: (i) the phase-plane x(t) versus y(t), (ii) the time course x(t) versus t, and (iii) the time course y(t)
1. a = 1, b = 1, c = 1, d = 1
2. a = 1, b = 4, c = 2, d = 3
3. a = 1, b = 2, c = 2, d = 1
4. a = 2, b = 0, c = 0, d = 1
5. a = 1, b = 0, c = 0, d = 1
6. a = 2, b = 0, c = 0, d = 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
