## Problem #24

For the system of differential equations below,

(a) Find the eigenvalues of the given system.
(b) Choose an initial point (other than the origin) and draw the corresponding trajectory in the x1x2-plane. Also draw trajectories in the x1x3- and x2x3-planes.
(c) For the initial point in part (b), draw the corresponding trajectory in x1x2x3-space

## Part (a)

We will use MATLAB to find both the eigenvalues and eigenvectors of the coefficient matrix A:

```  >> A = [-1/4 1 0;-1 -1/4 0;0 0 1/10];
>> [V,D]=eig(A)
V =
0.7071             0.7071                  0
0 + 0.7071i        0 - 0.7071i        0
0                  0             1.0000
D =
-0.2500 + 1.0000i        0                  0
0            -0.2500 - 1.0000i        0
0                  0             0.1000
>>
```

So, we see that the matrix A has two complex eigenvalues and one real eigenvalue . Recall that we can scale eigenvectors, so we will use a = [1;0;0] and b = [0;1;0] for convenience

## Part (b)

Using the eigenvectors v1 = a + ib, v2 = a - ib and v3 from above (the columns of the matrix V), we can construct the 3 components of the solution using formulas (9) and (10) in Section 7.6.

Let's choose c1 = 1, c2 = 2, and c3 = 3. Then, our solution is given by the three component functions:

Let's plot these in pairs in 2-dimensional coordinate planes. First, we will define all three functions in MATLAB, then plot them together in the coordinate planes. The MATLAB 'subplot' command will show all 3 plots side by side in the same window.

```  >> % Define the functions as character strings for 'ezplot'
>> % Use term-by-term multiplication '.*' for function commands used later.
>> strx1='exp(-.25*t).*cos(t) + 2*exp(-.25*t).*sin(t)';
>> strx2='-exp(-.25*t).*sin(t) + 2*exp(-.25*t).*cos(t)';
>> strx3='3*exp(t)';
>> % Open a figure window and set up a 1x3 grid of plots.
>> figure;
>> subplot(1,3,1);
>> % Plot x2-vs-x1.  Resize and label accordingly.
>> ezplot(strx1,strx2,[-10,10]);
>> xlabel('x_{1}(t)'); ylabel('x_{2}(t)');
>> title('x_{2}(t) -vs- x_{1}(t)');
>> axis([-30 30 -30 30]);
>> % Go to new subplot, plot x3-vs-x1.  Resize and label.
>> subplot(1,3,2);
>> ezplot(strx1,strx3,[-10,10]);
>> title('x_{3}(t) -vs- x_{1}(t)');
>> xlabel('x_{1}(t)'); ylabel('x_{3}(t)');
>> axis([-5 5 -5 5]);
>> % Go to new subplot, plot x3-vs-x2.  Resize and label.
>> subplot(1,3,3);
>> ezplot(strx2,strx3,[-10,10]);
>> xlabel('x_{2}(t)'); ylabel('x_{3}(t)');
>> title('x_{3}(t) -vs- x_{2}(t)');
>> axis([-5 5 -5 5]);
```

## Part (c)

Now, we want to create a 3-dimensional plot of the parametrically defined curve (x1(t), x2(t), x3(t)). For this, we use the MATLAB 'plot3' command. First, we need to convert the function names as strings into inline functions that we can evaluate.

```  >> x1=inline(strx1,'t');
>> x2=inline(strx2,'t');
>> x3=inline(strx3,'t');
>> tpts=-10:0.01:10;     % t-values for evaluation of (x1, x2, x3)
>> figure
>> plot3(x1(tpts),x2(tpts),x3(tpts));   % Parametrically plot solution
>> axis([-30 30 -30 30 0 10]);
>> xlabel('x_{1}(t)'); ylabel('x_{2}(t)'); zlabel('x_{3}(t)');
```