Problem #30

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

where x1 and x2 are the deviations of the salt levels Q1 and Q2 from their respective equilibria.

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

(b) Plot x1 versus t and x2 versus t on the same set of axes.

(c) Find the time T such that for all

Part (a)

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 c1 and c2, 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

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:

Part (b)

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.

Part (c)

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 x1 and x2 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 =
  >> x2(50)
  ans =
  >> x1(100)
  ans =
  >> x2(100)
  ans =

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 f1(t) = x1(t) + 0.5 and f2(t) = x2(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 =
  >> fzero(f2,[50,100])   % Find the zero of f2; where x2(t) = 0.5 
  ans =

Thus, x2 is within 0.5 units of zero when T2 = 66.2838, much earlier than x1 is within 0.5 units of zero at T1 = 74.3942. Thus, the value of T when both curves are within 0.5 units of the x-axis is T = 74.3942.