The two-tank system of Problem 22 in Section 7.1 leads to the initial value problem

where *x*_{1} and *x*_{2} are the deviations
of the salt levels *Q*_{1} and *Q*_{2} from their respective equilibria.

(a) Find the solution of the given initial value problem.

(b) Plot *x*_{1} versus *t* and *x*_{2} versus *t* on the same set of axes.

(c) Find the time *T* such that for
all

Before we begin to solve this problem, we need the eigenvalues and
eigenvectors of the coefficient matrix, which we will call *A*.

>> A=[-1/10 3/40;1/10 -1/5]; % Enter the coefficient matrix A >> [V,D]=eig(A) V = % The columns of V are the eigenvectors of A 0.8321 -0.4472 0.5547 0.8944 D = % Diag. entries of D are the eigenvalues of A -0.0500 0 0 -0.2500 >>

So, the eigenvalues and eigenvectors of *A* are

Thus, the general solution to the system of differential equations is

To find the coeffiecients *c*_{1} and *c*_{2},
we set *t* = 0 and solve the resulting linear system.

>> C=V\[-17;-21] % This says C = Inverse(V)*[-17;-21] C = % These are the coefficients c1 and c2 -24.7882 -8.1057 >>

Thus, the solution to the initial value problem is

Just for the sake of curiosity, we can use 'dirfield2d' (MATLAB module available here) to create a phase plot for this system and also to plot the solution to the stated initial value problem. The resulting graph is shown below:

First, let's separate the solution vector **x** into the two parametric functions *x(t)* and *y(t)*.

Now, we'll plot them together using MATLAB.

>> x1=inline('-20.62626*exp(-0.05*t) + 3.62487*exp(-0.25*t)','t'); >> x2=inline('-13.75001*exp(-0.05*t) - 7.24974*exp(-0.25*t)','t'); >> figure; hold on; >> fplot(x1,[0,50]); >> fplot(x2,[0,50],'r'); >> xlabel('time'); ylabel('Deviations in Salt Levels from Equilibria'); >> title('x_{1}(t) -vs- t in Blue and x_{2}(t) -vs- t in Red'); >>

We can see that both quantities approach 0 as *t* approaches infinity,
which makes sense in the context of the original problem in Chapter 7.1,
Problem #22.

Now we'd like to find the *t*-value at which both of these
curves are within 0.5 units of the origin, corresponding to the salt
levels being within 0.5 units of
their respective equilibria. From the graph above, it appears that the
*t*-value of this point, which we shall call *T*, is much farther
to the right than what is shown in the window. We can call the inline functions
*x*_{1} and *x*_{2} to evaluate them in MATLAB to get
a feel for how far out we need to look to get values within 0.5 units of
zero.

>> x1(50) ans = -1.6931 >> x2(50) ans = -1.1287 >> x1(100) ans = -0.1390 >> x2(100) ans = -0.0926 >>

So, we can see that *T* is somewhere between 50 and 100. However,
this is a mighty tedious approach to finding a precise value of T. Instead,
let's use MATLAB's 'fzero' function to find the zeros of the functions
*f*_{1}*(t)* = *x*_{1}(*t*) + 0.5 and
*f*_{2}*(t)* = *x*_{2}(*t*) + 0.5.

>> % First, define new functions f1 = x1 + 0.5 and f2 = x2 + 0.5 >> f1=inline('-20.62626*exp(-0.05*t) + 3.62487*exp(-0.25*t)+0.5','t'); >> f2=inline('-13.75001*exp(-0.05*t) - 7.24974*exp(-0.25*t)+0.5','t'); >> fzero(f1,[50,100]) % Find the zero of f1; where x1(t) = 0.5 ans = 74.3942 >> fzero(f2,[50,100]) % Find the zero of f2; where x2(t) = 0.5 ans = 66.2838 >>

Thus, *x*_{2} is within 0.5 units of zero when
*T*_{2} = 66.2838, much earlier than *x*_{1}
is within 0.5 units of zero at *T*_{1} = 74.3942. Thus, the
value of *T* when both curves are within 0.5 units of the *x*-axis
is *T* = 74.3942.