Consider the initial value problem
(a) Solve the initial value problem and plot its solution for
(b) Determine where the solution has the value zero.
(c) Determine the coordinates (t0, y0) of the minimum point.
(d) Change the second initial condition to y'(0) = b and find the solution as a function of b. Then find the critical value b that separates solutions that always remain positive from those that eventually become negative.
The MATLAB module Ch03Sec05Prob15 will solve a second order linear initial value problem and plot the solution in the case of constant coefficients and repeated real roots of the characteristic equation. The differential equation is entered as a vector that contains the coefficients of the characteristic equation (enclosed in square brackets). The program also prompts the user for the domain of the function for the purpose of producing a graph. Here is a transcript of the MATLAB session that produced the graph below:
Enter the characteristic polynomial as a vector [a b c] =>[4 12 9]
We will solve the homogeneous equation:
4 y'' + 12 y' + 9 y = 0.
Enter the value of y(0) => 1
Enter the value of y'(0) => -4
Enter the domain of the function:
Minimum t-value => 0
Maximum t-value => 5
The solution to the IVP is y(t) = 1*exp(-1.5*t) + -2.5*t.*exp(-1.5*t).
From the graph in part (a), it appears that the solution has a zero somewhere near t = 0.5. We can use the built-in MATLAB function fzero to find this zero. The function from the program Ch03Sec05Prob15 is named 'y'. The following command will find a zero of the function y near t = 0.5 (if there is one):
>> zero=fzero(y,.5) % find a zero of the function y near t = 0.5
Thus, we see that the solution is zero when t = 0.4.
We can see from the graph in part (a) that the minimum point has t-coordinate near 1. To find the exact coordinates of the minimum point on the graph, we use the MATLAB command min, which returns both the minimum value of an array and the corresponding index.
>> disp([tpts(j) ymin])
Thus, we see that the minimum point on the graph has coordinates (1.0661, -0.3365).
Note: This is most likely not exactly the same result that we would obtain by finding the minimum of y using the derivative, since we are taking a graphical approach here.
The characteristic equation for this differential equation is
which has a repeated root . Thus, the general solution is
Plugging in the initial conditions, we get the linear system
whose solution is and . Thus, the solution to the system is
As we can see from the linear factor, if , then y(t) will be positive. If , then y(t) will eventually become negative.
The graph below (created with MATLAB's 'subplot' command) shows the solutions to this initial value problem for various values of b between -3.5 and 0.5. Here's the MATLAB code to generate this grid:
>> hold on
>> charpoly=[4 12 9];
>> A=[1 0; r(1) 1];
>> for i=1:9
yp0=-4+0.5*i; % start at b=-3.5 and increment by 0.5
stry=sprintf('%.6g*%s + %.6g*%s',x(1),y1str,x(2),y2str); % Construct the solution y
y=inline(stry,'t'); % Define the function y
ypts=feval(y,tpts); % Get y-coordinates of data points
plot(tpts,ypts); % Plot data points
axis([0 10 -.5 1]);
gphtitle=sprintf('b = %g',yp0); % Identify graph by 'b'
We can't see it here, but the case when b=-2.0 is the last case of these nine that has a dip below the horizontal axis.
Another useful view of the solutions is to see them together on the same set of axes. To generate the graph below, we repeat the above MATLAB code, omitting the 'subplot' and 'gphtitle=...' and 'title' commands. This uses the same initial conditions as the graphs in the grid above -- in fact, they are the exact same solution curves, just superimposed on the same axes.