Question 24.2: Use the shooting method to solve Eq. (24.6) for the same con...

Use the shooting method to solve Eq. (24.6) for the same conditions as Example 24.1: L = 10  m,  h^′ = 0.05  m^{−2},  T_∞ = 200  K,  T (0) = 300  K, \text{ and } T (10) = 400  K.

0=\frac{d^2}{d x^2}+h^{\prime}\left(T_{\infty}-T\right)            (24.6)

Equation (24.6) is first expressed as a pair of first-order ODEs:

\frac{dT}{dx} = z
\\ \frac{dz}{d x} = − 0.05(200 − T )

Along with the initial value for temperature T (0) = 300 K, we arbitrarily guess a value of z_{a1} = −5  K/m for the initial value for z(0). The solution is then obtained by integrating the pair of ODEs from x = 0 to 10. We can do this with MATLAB’s ode45 function by first setting up an M-file to hold the differential equations:

function dy = Ex2402(x,y)
dy = [y(2);−0.05*(200 − y(l))];

We can then generate the solution as

>> [t,y] = ode45(@ Ex2402,[0 10],[300,− 5]);
>> Tb1 = y(length(y))
Tb1 =
569.7539

Thus, we obtain a value at the end of the interval of T_{b1} = 569.7539 (Fig. 24.4a), which differs from the desired boundary condition of T_b = 400. Therefore, we make another guess z_{a2} = −20 and perform the computation again. This time, the result of T_{b2} = 259.5131 is obtained (Fig. 24.4b).
Now, because the original ODE is linear, we can use Eq. (24.11) to determine the correct trajectory to yield the perfect shot:
z_a=z_{a 1}+\frac{z_{a 2}-z_{a 1}}{T_{b 2}-T_{b 1}}\left(T_b-T_{b 1}\right)       (24.11)
z_a=-5+\frac{-20-(-5)}{259.5131-569.7539}-(400-569.7539)=-13.2075
This value can then be used in conjunction with ode45 to generate the correct solution, as depicted in Fig. 24.4c.
Although it is not obvious from the graph, the analytical solution is also plotted on Fig. 24.4c. Thus, the shooting method yields a solution that is virtually indistinguishable from the exact result.

fig24.4

Related Answered Questions