Solutions to Problems in Chapter Eight Solutions to Test Your Understanding Problems T8.1-1 Z π 0 sin x dx = − cos x|π0 = − cos π + cos 0 = 1 + 1 = 2 T8.1-2 The equation of motion is mv̇ = f , or v̇ = f /m = 5g. (a) Z v(10) = 0 10 5g dt = 5g(10) = 50(9.81) = 490.5 m/sec (b) Z v(t) = Z h(t) = Z 10 0 v(t) dt = 0 10 t 5g dt = 5gt 0 10 t2 5gt dt = 5g = 250g = 2452.5 meters 2 0 T8.1-3 (a) Let y = 3x. Then d sin 3x d sin y dy = = (cos y)3 = 3 cos 3x dx dy dx (b) Let y = cos x. Then d cos2 x dy 2 dy = = 2y(− sin x) = −2 cos x sin x dx dy dx (c) dx3 ln x d ln x x3 dx3 = ln x + x3 = 3x2 ln x + = x2 (3 ln x + 1) dx dx dx x (d) Let f = sin x and g = x2 . Note that df dg − f dx g dx d(f /g) = dx g2 Then d (sin x)/x2 x cos x − 2 sin x x2 cos x − 2x sin x = = dx x4 x3 T8.2-1 Use the velocity calculations given in the table in Example 8.2-1. The script file is similar to the third script file in Example 8.2-1, with v replacing a and x replacing v. 8-1 t = [0:10]; v = [0,1,4,9.5,18.5,32.5,53,81,117,162,211.5]; x(1) = 0; for k = [1:10] x(k+1) = trapz(t(k:k+1),v(k:k+1))+x(k); end disp([t0,x0 ]) The results are (time is in the first column; displacement is in the second column): 0 0 1.0000 0.5000 2.0000 3.0000 3.0000 9.7500 4.0000 23.7500 5.0000 49.2500 6.0000 92.0000 7.0000 159.0000 8.0000 258.0000 9.0000 397.5000 10.0000 584.2500 T8.2-2 The closed form solution is Z 5 2 1 5 dx = ln x|52 = ln 5 − ln 2 = ln = 0.9163 x 2 The Matlab session is as follows. quad(01./x0 ,2,5) ans = 0.9163 quadl(0fn0 ,2,5) ans = 0.9163 Here quad and quadl give the same result to four decimal places. T8.2-3 The session is quad(0sqrt0 ,0,1,.001) ans = 0.6635 8-2 quadl(0sqrt0 ,0,1,.001) ans = 0.6666 The value obtained with quad and quadl using the default tolerance is 0.6667 to four decimal places. Thus a tolerance of 0.001 produces a less accurate answer. T8.3-1 The forward difference estimate is simply shifted one index relative to the backward difference estimate. Thus, simply replace the first plot command in the program given in the text above the problem with plot(x(2:n),td(2:n),x(1:n-1),d1,’o’),xlabel(’x’),..., and change the gtext labeling function. The results are shown in the figure. As you would expect, the backward estimate performs similarly to the forward estimate. 2 Forward Difference Estimate Derivative 1 0 −1 −2 0 0.5 1 1.5 x 2 2.5 3 2 Central Difference Estimate Derivative 1 0 −1 −2 0 0.5 1 1.5 x 2 2.5 Figure : for Problem T8.3-1. T8.4-1 (a) The roots are s = −4 and −7. The form of the free response is y(t) = C1 e−4t + C2 e−7t (b) The roots are s = −3 ± 5i. The form of the free response is y(t) = Be−3t sin(5t + φ) 8-3 3 (c) The roots are s = −3 and 5. The form of the free response is y(t) = C1 e−3t + C2 e5t (d) The roots are s = 4 and −10. The form of the free response is y(t) = C1 e4t + C2 e−10t T8.5-1 Solve for the derivative: dy te−2t − y = dt 10 The model’s time constant is 10, but the time constant of the input is 0.5. So we select ∆ to be a small fraction of 0.5, say ∆ = 0.5/20. The script file for the Euler method is delta = .5/20; y(1)=2; k = 0; for time = [delta:delta:2] k = k+1; y(k+1) = y(k) + 0.1*(time*exp(-2*time)-y(k))*delta; end t = [0:delta:2]; y_true = (732*exp(-0.1*t)-19*t.*exp(-2*t)-10*exp(-2*t))/361; plot(t,y,’o’,t,y_true),xlabel(’t’),ylabel(’y’) The plot is shown in the figure. The numerical solution is shown by the circles. It matches the true solution. The script file for the modified Euler method is shown in the figure. Its plot is similar to that of the Euler method. delta = .5/20; y(1)=2; k = 0; for time = [delta:delta:2] k = k+1; x(k+1) = y(k) + 0.1*(time*exp(-2*time)-y(k))*delta; y(k+1) = y(k)+(delta/2)*(0.1*(time*exp(-2*time)-y(k)) + ... 0.1*(time*exp(-2*time)-x(k+1))); end t = [0:delta:2]; y_true = (732*exp(-0.1*t)-19*t.*exp(-2*t)-10*exp(-2*t))/361; plot(t,y,’o’,t,y_true),xlabel(’t’),ylabel(’y’) 8-4 2 1.95 1.9 y 1.85 1.8 1.75 1.7 1.65 0 0.2 0.4 0.6 0.8 1 t 1.2 1.4 1.6 1.8 2 Figure : for Problem T8.5-1a. T8.5-2 Define the function file: function ydot = T8P5D2(t,y) global tau, a, b, c, y0 v = a + b*sin(c*t); ydot = (v-y)/tau; The script file for τ = 3, a = 5, b = 2, c = 8, y(0) = 6, and 0 ≤ t ≤ 10 is global tau, a, b, c, y0 tau = 3;a = 5;b = 2;c = 8;y0 = 6;tf = 10; [t,y] = ode23(0 T8P5D20 , [0, tf], y0); plot(t,y),xlabel(0t0 ),ylabel(0y0 ) T8.6-1 First create the function file msd shown in the text. Then create the following script file, which calls msd. global c f k m 8-5 6 5 Displacement (m) and Velocity (m/sec) Displacement 4 3 2 1 0 −1 Velocity −2 −3 0 0.5 1 1.5 2 2.5 Time (sec) 3 3.5 4 Figure : for Problem T8.6-1. m = 2;c = 3;k = 7;f = 35; [t,x]=ode23(’msd’, [0, 5], [2,-3]’); plot(t,x),xlabel(’Time (sec)’),... ylabel(’Displacement (m) and Velocity (m/sec)’),... gtext(’Velocity’),gtext(’Displacement’) The plot is shown in the figure. 8-6 4.5 5 T8.7-1 sys1 = tf(1,[5,7,4]); [A,B,C,D] = ssdata(sys1); sys2 = ss(A,B,C,D); sys3 = tf(sys2) [right, left] = tfdata(sys3, ’v’) right = 1 left = 5.000 7.000 4.000 Thus we obtain the same equation coefficients that we started with. Solutions to End-of-Chapter Problems 1. The analytical solution is easier. It is Z x(10) = 10 2 (5 + 7t ) dt = 2 7t3 5t + 3 !10 6944 = 2354.6667 = 40 + 3 2 The Matlab session is x = quad(0 2.3547e+0030,2,10) x = 2.3547e+003 2. The analytical solution is easier. The total distance traveled is Z D(1) = or Z D(1) = 2 1 0 1/2 0 |cos πt| dt = Z Z 1/2 cos πt dt + 0 1 1/2 − cos πt dt sin pit 1/2 2 π 2 cos πt dt = 2 = sin − sin 0 = π 0 π 2 π The displacement is Z x(1) = 0 Z 1 v(t) dt + x(0) = 1 0 sin πt 2 cos πt dt + 2 = +2=2 π 0 The Matlab session is D = quad(0 abs(cos(pi*x))0,0,1) D = 0.6366 x = quad(0 cos(pi*x)0,0,1)+2 x = 2 8-7 3. We must integrate twice to find the distance, and this is difficult to do in Matlab with the numerical integration functions quad and trapz. Thus the analytical solution is easier. It is t Z t Z t 5t2 5t2 v(t) = a(t) dt + v(0) = 5t dt + 3 = +3 +3= 2 0 2 0 0 The plot is shown in the figure. To find the distance D traveled in 5 seconds, note that the velocity is always positive. Thus ! ! Z 5 5t2 5 t3 D= = 119.1667 meters + 3 dt = + 3t 2 2 3 0 t=5 70 60 Velocity (m/sec) 50 40 30 20 10 0 0 0.5 1 1.5 2 2.5 Time (sec) 3 3.5 4 4.5 5 Figure : for Problem 8.3. 4. Analytical solution: 1 v(t) = C Z 0 t 5 i dt = 10 Z t 0 or −4 2(1 + sin 5t)10 v(t) = 20t + 20 Z dt = 20 t 0 (1 + sin 5t) dt − cos 5t t = 20t − 4 cos 5t + 4 5 0 The plot is shown in the figure. 8-8 Because a plot was requested, it is easier to do this problem analytically. However, for functions that are difficult to evaluate analytically, a numerical solution can be obtained by using the quad function repetitively. This method is based on the fact that we can write the integral as the sum of integrals. See the solution to Problem 14 for a discussion of this method. 25 20 v 15 10 5 0 0 0.2 0.4 0.6 t 0.8 1 Figure : for Problem 8.4. 8-9 1.2 5. The analytical solution is easier. It is Z W = 5 1 5 k dx = − kx−1 = 0.8k 1 x To solve the problem with Matlab, first define the following function. The session is I = quad(0 1./x.^20 ,1,5) I = 0.8000 Thus W = kI = 0.8k. 6. The analytical method is the easiest because the derivatives of x(t) are easily found. v(t) = dx = 6 sin 5t + 30t cos 5t dt a(t) = 30 cos 5t + 30 cos 5t − 150t sin 5t = 60 cos 5t − 150t sin 5t The script file to plot these functions is given below. We use a time increment that is a small fraction of the period, which is 2π/5. dt = (1/50)*(2*pi/5); t = [0:dt:5]; v=6*sin(5*t)+30*t.*cos(5*t); a=60*cos(5*t) -150*t.*sin(5*t); plot(t,v,t,a),xlabel(’t’),ylabel(’Velocity and Acceleration’),... gtext(’v’),gtext(’a’) The plot is shown in the figure. 7. The problem should be done analytically. The solution is v= dh = 6 − 2(4.9)t dt Thus v(0) = 6 The answer is in meters/second. 8. The problem must be done analytically. The solutions are: (a) dV = 2πrh − πh2 dh 8-10 800 600 Velocity and Acceleration 400 a 200 v 0 −200 −400 −600 −800 0 0.5 1 1.5 2 2.5 t 3 3.5 4 4.5 5 Figure : for Problem 8.6. (b) dV dh dV dh = = (2πrh − πh2 ) dt dh dt dt 9. The problem must be done using numerical integration because the velocity is not given as a function. Z Z 10 x(10) = 0 10 v(t) dt + x(0) = 0 v(t) dt + 3 The script file is v = [0,2,5,7,9,12,15,18,22,20,17]; x = trapz(v) + 3 Note that trapz does not require a vector of time values because the spacing between the time values is 1. The answer is x(10) = 121.5 meters. 10. This problem is much easier to do numerically. The relation between height h and the volume inflow rate r is dh 100 =r dt 8-11 Thus 1 100 h(t) = Z t r dt 0 The Matlab m-file is t = [0:10]; r = [0,80,130,150,150,160,165,170,160,140,120]; h = (1/100)*trapz(t,r) The answer for the final height is given by h and is 13.65 feet. 11. This problem requires both analytical and numerical methods. (a) Let 2 1 R 1.5 2 3π 1 b= π = π = 3 H 3 4 64 Then V = bh3 . When the cup is full, h = 4 inches, and the water volume is V = b(4)3 = 64b = 3π. Let q be the flow rate (q = 2 cubic inches per second). From mass conservation, dV =q dt and Z V (t) = 0 Z t q(t) dt = 0 t 2 dt = 2t Equating the two expressions for the water volume gives 2t = 64b, or t = 32b = 3π/2 = 4.7 seconds. (b) If q(t) = 2(1 − e−2t ), then Z V (t) = Z t 0 q(t) dt = 0 t " −2t 2(1 − e 2e−2t ) dt = 2t − −2 #t = 2t + e−2t − 1 0 The time to fill is found by equating the two expressions for the volume: 2t + e−2t − 1 = 64b = 3π We can solve this for t either by plotting the expression or by using the fzero function. First define the function cup: function f = cup(t) f = 2*t+exp(-2*t)-1 - 3*pi; Use the fzero function with the answer from part (a) as the starting guess: 8-12 fzero(’cup’,4.7) ans = 5.2124 Thus it will take about 5.2 seconds to fill the cup. 12. From Newton’s law mv̇ = f , or v̇ = i 500 h 2 − e−t sin(5πt) 100 Integrate from t = 0 to t = 5, using v(0) = 0: Z v(5) = 5 0 5h i 2 − e−t sin(5πt) dt Because a plot of v(t) is not asked for, it is easier to do this problem numerically, even though the integral can be found in most tables (its expression is a little messy). Use the quadl function as follows (the quad function warned of a singularity in this problem and gives a slightly different answer, so we use the quadl function): 5*quadl(’2-exp(-t).*sin(5*pi*t’,0,5) ans = 49.6808 Thus the velocity is 49.6808 meters/second after 5 seconds. 13. Note that m(t) = 2200(1 − 0.8t/40) and that dv T = −g dt m(t) Integrate both sides of this equation to obtain Z v(40) = 40 0 T dt − 40g = m(t) or Z v(40) = 0 40 Z 40 0 48000 dt − 40g 2200(1 − 0.8t/40) 240 dt − 40(9.81) 11(1 − 0.02t) The analytical solution is v(40) = − 240 ln (1 − 0.02t)|40 0 − 40(9.81) = 1363.4 0.02(11) Thus the burnout velocity is 1363.4 meters/second. The Matlab session is 8-13 quad(’240./(11*(1-.02*t))’,0,40)-40*9.81 ans = 1.3634e+003 The velocity at burnout is 1363.4 meters/second. 14. The integral is v(t) = 1 10−6 Z th 0 i 0.01 + 0.3e−5t sin(25πt) 10−3 dt = Z th 0 i 10 + 300e−5t sin(25πt) dt Both the analytical and numerical solution methods have the pros and cons with this problem. The integral is messy to evaluate analytically, but we need to plot the voltage v(t), which is harder to do with a numerical solution. Here is the analytical solution. Z th v(t) = 0 −5t 10 + 300e " #t e−5t (−5 sin 25πt − 25π cos 25πt) sin(25πt) dt = 10t + 300 52 + (25π)2 0 i or v(t) = 10t − 0.0484e−5t (5 sin 25πt + 25π cos 25πt) + 3.804 This function can now be plotted. Here is the numerical solution. First define the following function. function f = fn(t) f=10+300*exp(-5*t).*sin(25*pi*t); The following script file solves for and plots the solution v(t) for 0 ≤ t ≤ 0.3. It uses the fact that an integral can be expressed as the sum of integrals: Z 0 Z tn f (t) dt = 0 t1 Z f (t) dt + t2 t1 f (t) dt + · · · + Z tn f (t) dt tn−1 tmin = 0;tmax = 0.3;n = 300; t = linspace(tmin,tmax,n); vp = 0; for k = 1:n-1 v(k) = vp+quadl(’fn’,t(k),t(k+1)); vp = v(k); end plot(t(1:n-1),v),xlabel(’t (sec)’),ylabel(’v (volts)’) 8-14 The plot is shown in the figure. We note here that this problem can also be solved by converting the integral equation into a differential equation by differentiating both sides with respect to t. The result is dv = 10 + 300e−5t sin(25πt) dt This equation can then be solved numerically with the differential equation methods presented in Section 8.5. 8 7 6 v (volts) 5 4 3 2 1 0 0 0.05 0.1 0.15 t (sec) 0.2 0.25 Figure : for Problem 8.14. 8-15 0.3 15. The script file is a modification of that shown in Section 8.3. x = [0:10]; y = [0,2,5,7,9,12,15,18,22,20,17]; n=length(x); d1 = diff(y)./diff(x); subplot(3,1,1) plot(x(1:n-1),d1,x(1:n-1),d1,’o’),xlabel(’x’),... ylabel(’Derivative’),axis([0 10 -5 5]),... gtext(’Forward Difference Estimate’) subplot(3,1,2) plot(x(2:n),d1,x(2:n),d1,’o’),xlabel(’x’),... ylabel(’Derivative’),axis([0 10 -5 5]),... gtext(’Backward Difference Estimate’) d2 = (y(3:n)-y(1:n-2))./(x(3:n)-x(1:n-2)); subplot(3,1,3) plot(x(2:n-1),d2,x(2:n-1),d2,’o’),xlabel(’x’),... ylabel(’Derivative’),axis([0 10 -5 5]),... gtext(’Central Difference Estimate’) The plot is shown in the figure. The three estimates agree where y is not rapidly changing. However, at the values of x where y is rapidly changing, the central difference method“smoothes” the data. Its estimate of the derivative does not fluctuate as much as the other estimates. 8-16 Derivative 5 0 Forward Difference Estimate −5 0 1 2 3 4 Derivative 5 6 7 8 9 10 5 x 6 7 8 9 10 5 x 6 7 8 9 10 0 Backward Difference Estimate −5 0 1 2 3 4 5 Derivative 5 x 0 Central Difference Estimate −5 0 1 2 3 4 Figure : for Problem 8.15. 16. The data shows that a relative maximum is near x = 5 and that another maximum is on the boundary at x = 10. One way to solve the problem is to fit a polynomial to the data near x = 5, and then differentiate the polynomial. The script file is x=[3:7]; y = [7,9,10,8,7]; p = polyfit(x,y,4); xp=[3:.05:7]; yp = polyval(p,xp); plot(x,y,’o’,xp,yp),xlabel(’x’),ylabel(’y’) der = polyder(p); solution = roots(der) solution = 6.7366 4.8127 2.9508 The plot of the polynomial and the data shown in the figure confirms that there is a good fit. 8-17 10.5 10 9.5 y 9 8.5 8 7.5 7 6.5 3 3.5 4 4.5 5 x 5.5 6 6.5 7 Figure : for Problem 8.16c. The polynomial has a zero derivative at x = 6.7366, 4.8127, and 2.9508. The solution we want is x = 4.8127. The other two solutions correspond to minima of the polynomial. The estimated maximum value of y is computed from the polynomial at x = 4.8127. polyval(p,4.8127) ans = 10.0627 Thus the estimated maximum value of y is 10.0627. 8-18 17. The true derivative is dy = −e−x sin(3x) + 3e−x cos(3x) dx The script file is a modification of that shown in Section 8.3. x = linspace(0,4,101); n = length(x); td = -exp(-x).*sin(3*x) +3*exp(-x).*cos(3*x); y = exp(-x).*sin(3*x)+0.01*(rand(1,n)-0.5); d1 = diff(y)./diff(x); subplot(3,1,1) plot(x(2:n),td(2:n),x(1:n-1),d1,’o’),xlabel(’x’),... ylabel(’Derivative’),axis([0 4 -2 2]),... gtext(’Forward Difference Estimate’) subplot(3,1,2) plot(x(1:n-1),td(1:n-1),x(1:n-1),d1,’o’),xlabel(’x’),... ylabel(’Derivative’),axis([0 4 -2 2]),... gtext(’Backward Difference Estimate’) d2 = (y(3:n)-y(1:n-2))./(x(3:n)-x(1:n-2)); subplot(3,1,3) plot(x(2:n-1),td(2:n-1),x(2:n-1),d2,’o’),xlabel(’x’),... ylabel(’Derivative’),axis([0 4 -2 2]),... gtext(’Central Difference Estimate’) The plots are shown in the figure. The central difference method gives the better estimate of the derivative. 8-19 Derivative 2 Forward Difference Estimate 0 −2 0 0.5 1 1.5 Derivative 2 2.5 3 3.5 4 Backward Difference Estimate 0 −2 0 0.5 1 1.5 2 Derivative 2 x 2 x 2.5 3 3.5 4 Central Difference Estimate 0 −2 0 0.5 1 1.5 2 x 2.5 3 Figure : for Problem 8.17. 8-20 3.5 4 18. The analytical method is the easiest here because the analytical solution is given by equation (8.4-10). y(t) = 5e−t/5 + 10 1 − e−t/5 The response is at steady state after approximately t = 20. The following script file produces the plot. t = [0:.005:20]; y = 5*exp(-t/5)+10*(1-exp(-t/5)); plot(t,y),xlabel(’t’),ylabel(’y’) 10 9.5 9 8.5 y 8 7.5 7 6.5 6 5.5 5 0 2 4 6 8 10 t 12 14 Figure : for Problem 8.18. 8-21 16 18 20 19. The analytical method is the easiest here because the analytical solution is given by equation (8.4-10). y(t) = 2e−5t + 10 1 − e−5t The response is at steady state after approximately t = 4/5. The following script file produces the plot. t = [0:.003:4/5]; y = 2*exp(-5*t)+10*(1-exp(-5*t)); plot(t,y),xlabel(’t’),ylabel(’y’) 10 9 8 y 7 6 5 4 3 2 0 0.1 0.2 0.3 0.4 t 0.5 0.6 0.7 0.8 Figure : for Problem 8.19. 20. For t ≥ 0, the equation is dT + T = 170 dt with the initial condition T (0) = 70. The analytical solution is given by equation (8.4-10). 10 T (t) = 70e−t/10 + 170 1 − e−t/10 (a) The mathematical solution indicates that it will take an infinite amount of time for the object’s temperature to reach the bath temperature. 8-22 (b) The initial temperature difference is 170◦ − 70◦ = 100◦ . The time constant is 10 seconds, so it will take 40 seconds for the temperature difference to decay to 2◦ , which is 2% of its initial value. Thus the object’s temperature will be 168◦ at t = 40 seconds. (c) The following script file produces the plot. t = [0:.01:40]; T = 70*exp(-t/10)+170*(1-exp(-t/10)); plot(t,T),xlabel(’t (seconds)’),ylabel(’T (degrees F)’) 170 160 150 T (degrees F) 140 130 120 110 100 90 80 70 0 5 10 15 20 t (seconds) 25 30 35 40 Figure : for Problem 8.20. 21. The analytical method is the easiest here because the analytical solution is given by equation (8.4-10), which is based on equation (8.4-8). Put the sled’s equation into the same form as (8.4-8): 1000 f v̇ + v = 500 500 (a) If f is constant, the solution is given by (8.4-10) with v(0) = 0. v(t) = f f 1 − e−500t/1000 = 1 − e−t/2 500 500 8-23 (b) As t → ∞, the solution shows that v → f /500. The time constant is 2 seconds, and the response is at steady state after approximately four time constants, or 8 seconds. 22. Because we are not given the initial conditions, we cannot use a numerical method here. The form of the free response depends on the characteristic roots, which are the roots of the following polynomial. ms2 + cs + k = 0 (a) The characteristic polynomial is 3s2 +18s+102 = 0, which has the roots: s = −3±5i. Thus the form of the free response is y(t) = Be−3t sin(5t + φ) where B and φ depend on the initial conditions. The free response oscillates with a frequency of 5 radians/unit time. The time constant is found from the negative reciprocal of the real part: τ = 1/3. The oscillations disappear after approximately four time constants, or t = 4τ = 4(1/3) = 4/3. (b) The characteristic polynomial is 3s2 + 39s + 120 = 0, which has the roots: s = −5, s = −8. Thus the form of the free response is y(t) = A1 e−5t + A2 e−8t where A1 and A2 depend on the initial conditions. The free response does not oscillate. The dominant time constant is 1/5, and thus the free response decays to 0 after approximately t = 4(1/5) = 4/5. 23. It is much easier to solve this problem numerically, especially because a plot is required. With the given values, the model is 0.2 dy + y = v(t) dt Solve for dy/dt: dy = 5[v(t) − y] dt where y(0) = 2 and v(t) = 10[2 − e−t sin(5πt)]. To use the ode23 solver, create the following function file: function ydot = rccirc1(t,y) v = 10*(2-exp(-t)*sin(5*pi*t)); ydot = 5*(v-y); Then use the ode23 solver in the following script file. [t, y] = ode23(’rccirc1’, [0, 5], 2); plot(t,y),xlabel(’t (seconds)’),ylabel(’ y (volts)’) 8-24 The plot is shown in the figure. The time constant of the input’s oscillations is 1 second, so the oscillations should disappear after approximately 4 seconds. The period of the input’s oscillations should be 2/5 second. The plot confirms these predictions. The circuit’s time constant is 0.2 seconds. Thus if the applied voltage were constant, the steady-state would be reached in about 4(0.2) = 0.8 seconds. This can be seen from the plot, which shows that the response oscillates about a curve that levels off at y = 20 after about 0.8 seconds. 22 20 18 16 y (volts) 14 12 10 8 6 4 2 0 0.5 1 1.5 2 2.5 t (seconds) 3 3.5 Figure : for Problem 8.23. 8-25 4 4.5 5 24. For the given values Cd A = 0.5π(2 × 10−2 )2 = 2π × 10−4 and the differential equation is π(6h − h2 ) or √ dh = −2π × 10−4 19.62h dt √ dh 2 × 10−4 19.62h =− dt 6h − h2 (a) The greatest outflow rate occurs when the water level is the highest (h = 5). Thus using h = 5 in the differential equation, we can obtain an lower bound on the time required to drain the tank. When h = 5, √ dh 2 × 10−4 19.62h = −3.9618 × 10−4 =− dt 6h − h2 This implies that h(t) = −3.9618 × 10−4 t + 5, and h = 0 at t = 5/(3.9618 × 10−4 ) = 12, 620 seconds, or 210 minutes. Thus the tank will empty in no less than 210.34 minutes. Instead of a lower bound on the estimate, we can obtain a higher estimate by using the mid-point value for h; namely, h = 5/2 = 2.5. Thus gives √ dh 2 × 10−4 19.62h = −1.6008 × 10−4 =− dt 6h − h2 This implies that h(t) = −1.6008 × 10−4 t + 5, and h = 0 at t = 5/(1.6008 × 10−4 ) = 31, 234 seconds, or 521 minutes. (b) To use the ode45 solver, solve for the derivative: √ dh 2 × 10−4 19.62h =− dt 6h − h2 and create the following function file: function hdot = tank(t,h) hdot = -(0.0002*sqrt(19.62*h))/(6*h-h^2); Then use the ode45 solver in the following script file. [t, h] = ode45(’tank’, [0, 25200], 5); plot(t,h),xlabel(’t (seconds)’),ylabel(’ h (feet)’) 8-26 Start with a final time of something more than 12,620 seconds, and run the file until the plot shows the height approaching zero. The time to empty, which is 25,200 seconds or 420 minutes, was found this way. The estimate of 521 minutes obtained with the mid-point height is not much different, and establishes confidence in the numerical result. Note that if you choose a final time somewhat larger than 25,200 seconds, the denominator in the expression for dh/dt becomes zero because h = 0, and the expression for dh/dt becomes undefined. This causes difficulties for the numerical algorithm. Thus it is best to start with a small value for the final time, and increase it. The plot is shown in the figure. 5 4.5 4 3.5 h (feet) 3 2.5 2 1.5 1 0.5 0 0 0.5 1 1.5 t (seconds) 2 Figure : for Problem 8.24. 8-27 2.5 3 4 x 10 25. (a) Write the equation as dy 2y =4− dt 10 + 2t Then create the following function file. function ydot = salt(t,y) ydot = 4-2*y/(10+2*t); The following file solves the problem using the ode45 solver. [t, h] = ode45(’salt’, [0, 10], 0); plot(t,h),xlabel(’Time t’),ylabel(’Salt Mass y’) The plot is shown in the figure. 30 25 Salt Mass y 20 15 10 5 0 0 1 2 3 4 5 Time t 6 7 Figure : for Problem 8.25. 8-28 8 9 10 (b) The variable coefficient 2/(10 + 2t) varies from 2/10 to 2/30 as t varies from 0 to 10. Its mid-point value is 4/30. Using this value the model becomes dy 4 + y=4 dt 30 Its response can be found from equation (8.4-10). It is y(t) = 4 1 − e−30t/4 = 30 1 − e−30t/4 4/30 This equation predicts that y(10) = 30. The plot shows that the numerical solution gives y(10) = 27 approximately. Thus we can have confidence that the numerical solution is correct. 26. The characteristic equation is 3s2 + 18s + 102 = 0 which has the roots s = −3 ± 5i. Thus the time constant is τ = 1/3 and the steady state response yss = 10/102 will be reached at about t = 4/3. So we choose a final time of t = 2, somewhat greater than 4/3 in order to see the entire transient response. The imaginary part 5i indicates that the response will oscillate with a radian frequency of 5, and a period of 2π/5. We can use the function file msd shown in the text. It is function xdot = msd(t,x) global c f k m A = [0,1;-k/m,-c/m]; B = [0;1/m]; xdot=A*x+B*f; We can modify the script file shown in the text following the function file msd, by entering the appropriate values for the parameters, as follows. Note that the plot function must be modified because the problem specified that only y be plotted. The vector x(:,1) contains the y values. global c f k m m = 3;c = 18;k = 102;f = 10; [t, x] = ode23(’msd’, [0, 2], [0, 0]); plot(t,x(:,1)),xlabel(’t’),ylabel(’y’) When this file is executed, it produces the plot shown in the figure. (b) Change the third line in the previous script file to 8-29 0.12 0.1 y 0.08 0.06 0.04 0.02 0 0 0.2 0.4 0.6 0.8 1 t 1.2 1.4 1.6 1.8 2 Figure : for Problem 8.26a. [t, x] = ode23(’msd’, [0, 2], [0, 10]); in order to use the initial values vector [0, 10]. The plot shown in the figure. The positive initial velocity causes a greater overshoot. 8-30 1 0.8 y 0.6 0.4 0.2 0 −0.2 0 0.2 0.4 0.6 0.8 1 t 1.2 1.4 1.6 1.8 2 Figure : for Problem 8.26b. 27. The characteristic equation is 3s2 + 39s + 120 = 0 which has the roots s = −5 and s = −8. Thus the dominant time constant is τ = 1/5 and the steady state response yss = 10/120 will be reached at about t = 4/5. So we choose a final time of t = 1.5, somewhat greater than 4/5 in order to see the entire transient response. We can use the function file msd given in the text. It is function xdot = msd(t,x) global c f k m A = [0,1;-k/m,-c/m]; B = [0;1/m]; xdot=A*x+B*f; We can modify the script file shown in the text following the function file msd, by entering the appropriate values for the parameters, as follows. Note that the plot function must be modified because the problem specified that only y be plotted. The vector x(:,1) contains the y values. 8-31 global c f k m m = 3;c = 39;k = 120;f = 10; [t, x] = ode23(’msd’, [0, 1.5], [0, 0]); plot(t,x(:,1)),xlabel(’t’),ylabel(’y’) When this file is executed, it produces the plot shown in the figure. 0.09 0.08 0.07 0.06 y 0.05 0.04 0.03 0.02 0.01 0 0 0.5 1 1.5 t Figure : for Problem 8.27a. (b) Change the third line in the previous script file to [t, x] = ode23(’msd’, [0, 1.5], [0, 10]); in order to use the initial values vector [0, 10]. The plot shown in the figure. The positive initial velocity causes a greater overshoot. 8-32 0.6 0.5 y 0.4 0.3 0.2 0.1 0 0 0.5 1 1.5 t Figure : for Problem 8.27b. 28. The equation has the general form mÿ + ky = f (t) ˙ where f (t) = 10 sin ωt. The state variable form, with x1 = y and x2 = (y), is ẋ1 = x2 ẋ2 = − k 1 x1 + f (t) m m Create the following function file: function xdot = mksine(t,x) global m k omega A = [0,1;-k/m,0]; B = [0;1/m]; f = 10*sin(omega*t); xdot=A*y+B*f; (a) The following script file uses the ode23 function to solve the equations and to plot the forcing function and the solution for x1 = y. 8-33 global m k omega omega = 1; m = 3;k = 75; [t, x] = ode23(’mksine’, [0, 20], [0, 0]); f = 10*sin(omega*t); subplot(2,1,1) plot(t,x(:,1)),xlabel(’t’),ylabel(’y(t)’) subplot(2,1,2) plot(t,f),xlabel(’t’),ylabel(’f(t)’) The plot is shown in the figure. y(t) 0.1 0 −0.1 0 2 4 6 8 10 t 12 14 16 18 20 2 4 6 8 10 t 12 14 16 18 20 10 f(t) 5 0 −5 −10 0 Figure : for Problem 8.28a. (b) Replace the second line in the previous file with omega = 5.1. The plot is shown in the figure. (c) Replace the second line in the previous file with omega = 10. The plot is shown in the figure. 8-34 6 4 y(t) 2 0 −2 −4 −6 0 2 4 6 8 10 t 12 14 16 18 20 2 4 6 8 10 t 12 14 16 18 20 10 f(t) 5 0 −5 −10 0 Figure : for Problem 8.28b. 8-35 y(t) 0.1 0 −0.1 0 2 4 6 8 10 t 12 14 16 18 20 2 4 6 8 10 t 12 14 16 18 20 10 f(t) 5 0 −5 −10 0 Figure : for Problem 8.28c. 8-36 p The natural frequency of a mass and spring is ωn = k/m. For this particular mass p and spring, m = 3, k = 75, and ωn = 75/3 = 5 radians per unit time. When the forcing frequency is below the natural frequency, as in part (a), the motion of the mass has an overall sinusoidal variation with smaller “ripples” superimposed on the motion. These ripples has the same period as the period corresponding to the natural frequency. Here this period is P = 2π/ωn = 1.26. You can see that the ripples in the plot have this period. The period of the low frequency component of the motion shown on the plot is the same as the period of the forcing function, which is 2π = 6.28. When the frequency of the forcing function is near the natural frequency, the condition called “resonance” occurs in which the displacement of the mass oscillates with a large amplitude. This condition is shown in the figure for part (b), where the forcing frequency ω = 5.1 is just slightly above the natural frequency. The amplitude of motion is much larger than for parts (a) and (c). The inertia of the mass prevents it from reacting to a rapidly-changing forcing function. Thus, as long as the forcing frequency is above the natural frequency, the greater the forcing frequency the smaller the amplitude of motion. This is shown in part (c). 29. The state variable form, with x1 = y and x2 = ẏ, is ẋ1 = x2 ẋ2 = −x1 + µ(1 − x21 )x2 Create the following function file: global mu mu = 1; [t, x] = ode45(’vanderp’, [0, 20], [2, 0]); plot(t,x(:,1)),xlabel(’t’),ylabel(’y(t)’) Then use the following script file to solve the equation and plot x1 = y. function xdot = vanderp(t,x) global mu xdot(1) = x(2); xdot(2) = mu*(1-x(1)^2)*x(2) -x(1); xdot = [xdot(1);xdot(2)]; The plot is shown in the figure. 8-37 2.5 2 1.5 1 y(t) 0.5 0 −0.5 −1 −1.5 −2 −2.5 0 2 4 6 8 10 t 12 14 16 18 20 Figure : for Problem 8.29. ˙ 30. The state variable form, with x1 = θ and x2 = (θ), is ẋ1 = x2 ẋ2 = a(t) cos θ − g sin θ) L Create the following function file: function xdot = accbase(t,x) global m b L = 1; g = 9.81; xdot(1) = x(2); xdot(2) = ((m*t + b)*cos(x(1)) -g*sin(x(1)))/L; xdot = [xdot(1);xdot(2)]; To solve the equation and plot the solution, create the following script file. The acceleration a(t) has been expressed as the linear function a(t) = mt + b. Thus for cases (a) and (b), m = 0 and b = 5. For case (c), m = 0.5 and b = 0. global m b 8-38 m = 0; b = 5; [t, x] = ode45(’accbase’, [0, 10], [0.5, 0]); plot(t,x(:,1)),xlabel(’t (seconds)’),ylabel(’theta(t) (radians)’) For cases (b) and (c), change the third line to [t, x] = ode45(’accbase’, [0, 10], [3, 0]); The results are shown in the following three plots. 0.51 0.5 theta(t) (radians) 0.49 0.48 0.47 0.46 0.45 0.44 0 1 2 3 4 5 t (seconds) 6 7 Figure : for Problem 8.30. 8-39 8 9 10 3 2 theta(t) (radians) 1 0 −1 −2 −3 0 1 2 3 4 5 t (seconds) 6 7 8 9 10 8 9 10 Figure : for Problem 8.30b. 4 3 theta(t) (radians) 2 1 0 −1 −2 −3 0 1 2 3 4 5 t (seconds) 6 7 Figure : for Problem 8.30c. 8-40 31. (a) Modify the program shown in Example 8.6-2 as follows: R = 0.8;L = 0.003;c =0; K_T = 0.05;K_e = 0.05;I = 8e-5; A = [-R/L,-K_e/L;K_T/I,-c/I]; disp(’The roots are:’) eig(A) disp(’The time constants are:’) -1./real(eig(A)) The results for the roots are s = −219.1303 and s = −47.5364. The time constants are: 0.0046 and 0.0210. The dominant time constant is 0.021 seconds. Thus it will take approximately 4(0.021) = 0.084 seconds for the motor speed to become constant if the applied voltage is switched from 0 volts to a constant nonzero value. (b) Because the motor model is a linear set of differential equations, we can use either an ode function or the step function to solve the equations. To use the ode23 function, first create the following function file, which is based on the state variable equations (8.6-10) and (8.6-11). Note that the first state variable is current; the second is velocity. function xdot = dcmotor1(t,x) global c I K_T K_e L R A=[-R/L,-K_e/L;K_T/I,-c/I]; B=[1/L;0]; v=20; xdot=A*x+B*v; Then create the following script file, like the third file given in Example 8.6-3. Choose a final time of 0.1, which is slightly larger than four time constants. global c I K_T K_e L R R = 0.8;L = 0.003;c = 0; K_T = 0.05;K_e = 0.05;I = 8e-5; [t, x] = ode23(’dcmotor1’, [0, .1], [0, 0]); subplot(2,1,1) plot(t,x(:,1)),xlabel(’Time (secs)’),ylabel(’Current (amps)’) subplot(2,1,2) plot(t,x(:,2)),xlabel(’Time (secs)’),ylabel(’Speed (rad/sec)’) The resulting plots are shown in the figure. To solve the problem using the step function, first create the state space model with the following script file: 8-41 Current (amps) 20 15 10 5 0 0 0.01 0.02 0.03 0.04 0.05 0.06 Time (secs) 0.07 0.08 0.09 0.1 0.01 0.02 0.03 0.04 0.05 0.06 Time (secs) 0.07 0.08 0.09 0.1 Speed (rad/sec) 400 300 200 100 0 0 Figure : for Problem 8.31b. R = K_T A = B = C = D = sys 0.8;L = 0.003;c = 0; = 0.05;K_e = 0.05;I = 8e-5; [-R/L,-K_e/L;K_T/I,-c/I]; [1/L;0]; [1, 0; 0,1]; 0; = ss(A,B,C,D); The unit step response can be plotted with the following command: step(sys). To find the response for v = 20, replace the line B=[1/L;0]; with B=[20/L;0];. It will look like the plots shown in the figures. (c) Create the following function file, like the function file dcmotor given in Example 8.6-3. function xdot = dcmotor2(t,x) global c I K_T K_e L R A = [-R/L,-K_e/L;K_T/I,-c/I]; B = [1/L;0]; if t < 0.05; v = 400*t; 8-42 elseif t <= 0.2 v = 20; elseif t <= 0.25 v = -400*(t-.2) + 20; else v = 0; end xdot=A*x+B*v; The following script file solves the equations and plots the applied voltage and the speed. global c I K_T K_e L R R = 0.8;L = 0.003;c = 0; K_T = 0.05;K_e = 0.05;I = 8e-5; t1=[0:.001:.05]; t2=[.051:.001:.2]; t3=[.201:.001:.25]; t4=[.251:.001:.3]; tp=[t1,t2,t3,t4]; v1=400*t1; v2=20*ones(1,length(t2)); v3=-400*(t3-.2)+20; v4=0*ones(1,length(t4)); v=[v1,v2,v3,v4]; [t, x] = ode23(’dcmotor4’, [0, .3], [0, 0]); subplot(2,1,1) plot(tp,v),xlabel(’Time (secs)’),ylabel(’Applied Voltage (volts)’), ... axis([0 .3 0 25]) subplot(2,1,2) plot(t,x(:,2)),xlabel(’Time (secs)’),ylabel(’Speed (rad/sec)’), ... axis([0 .3 0 450]) The plot is shown in the figure. 8-43 Applied Voltage (volts) 25 20 15 10 5 0 0 0.05 0.1 0.15 Time (secs) 0.2 0.25 0.05 0.1 0.15 Time (secs) 0.2 0.25 Speed (rad/sec) 400 300 200 100 0 0 Figure : for Problem 8.31c. 8-44 32. The script file is left = [10, 3, 7]; right = 1; sys = tf(right,left); [A, B, C, D] = ssdata(sys) This file produces the following results. " A= −0.3 −0.7 1 0 # h C= " B= 0.25 0 # i 0 0.4 D = [0] 33. The script file is left = [10, 6, 2]; right = [3, 1]; sys = tf(right,left); [A, B, C, D] = ssdata(sys) This file produces the following results. " A= −0.6 −0.4 0.5 0 h C= # " B= 1 0 # i 0.3 0.2 D = [0] 34. The script file is A = [-4, -1; 2, -3]; B = [2; 5]; C = [1, 0]; D = [0]; sys = ss(A,B,C,D); [right, left] = tfdata(sys, ’v’); This file produces the following results: right = [0 2] and left = [1 the reduced form model is ẍ1 + 7ẋ1 + 14y = 2u 8-45 7 14]. Thus 35. (a) The script file is A = [0, 1; -5, -2]; B = [0; 1]: C = [1, 0]; D = [0]; sys = ss(A,B,C,D); initial(sys, [5,3]) The resulting plot is shown in the figure. Initial Condition Results 6 5 4 Amplitude 3 2 1 0 −1 −2 0 1 2 3 4 Time (sec.) Figure : for Problem 8.35a. 8-46 5 6 (b) The script file is A = [0, 1; -5, -2]; B = [0; 10]: C = [1, 0]; D = [0]; sys = ss(A,B,C,D); step(sys) Note that we have included the effect of the step input magnitude in the matrix B = [0; 10]. The resulting plot is shown in the figure. Step Response 2.5 2 Amplitude 1.5 1 0.5 0 0 1 2 3 4 5 6 Time (sec.) Figure : for Problem 8.35b. 36. (a) To convert to state space form, let x1 = y and x2 = ẏ. Then the model is ẋ1 = x2 2 1 ẋ2 = −2x1 − x2 + f 5 5 Thus the model’s matrices are A= " 0 1 −2 − 25 # 8-47 " B= 0 1 5 # To plot y = x1 , choose h C= i 1 0 D = [0] The given initial values are y(0) = x1 (0) = 10 and ẏ(0) = x2 (0) = −5. The script file to find the free response is A = [0, 1; -2, -2/5]; B = [0; 1/5]: C = [1, 0]; D = [0]; sys = ss(A,B,C,D); initial(sys, [10,-5]) The plot is shown in the figure. Initial Condition Results 10 8 Amplitude 6 4 2 0 −2 0 0.5 1 1.5 2 2.5 3 3.5 Time (sec.) Figure : for Problem 8.36a. (b) The script file to find the step response is A B C D = = = = [0, 1; -2, -2/5]; [0; 1/5]: [1, 0]; [0]; 8-48 4 4.5 5 sys = ss(A,B,C,D); step(sys) The plot is shown in the figure. Step Response 0.12 0.1 Amplitude 0.08 0.06 0.04 0.02 0 0 0.5 1 1.5 2 2.5 3 3.5 Time (sec.) Figure : for Problem 8.36b. (c) The script file to find the total response is A = [0, 1; -2, -2/5]; B = [0; 1/5]: C = [1, 0]; D = [0]; sys = ss(A,B,C,D); t=[0:.01:5]; [y1,x1] =initial(sys,[10,-5],t); [y2,x2]=step(sys,t); y3=y1+y2; u=stepfun(t,0); [y4]=lsim(sys,u,t,[10,-5]); plot(t,y3,t,y4),xlabel(’t’),ylabel(’y’) 8-49 4 4.5 5 The plot is shown in the figure. The two curves are indistinguishable. Note that in this problem the total response is very similar to the free response, because the steady-state step response is very small compared to the free response (yss = 0.2). 10 9 8 7 y 6 5 4 3 2 1 0 0 0.5 1 1.5 2 2.5 t 3 3.5 4 4.5 5 Figure : for Problem 8.36c. 37. From Example 8.6-2 the smallest time constant is 0.0041 sec. Thus we chose a time increment that is much smaller than 0.0041, say 0.0041/20 ≈ 2 × 10−4 . The script file is shown in the figure. The time vectors t1, . . ., t4 are the time vectors for each of the four phases (the three trapezoidal segments and the final rest phase). The vectors v1, . . ., v4 contain the applied voltage v(t) for each of the four phases. dt = 2e-4; t1 = [0:dt:0.1-dt]; t2 = [0.1:dt:0.4-dt]; t3 = [0.4:dt:0.5-dt]; t4 = [0.5:dt:0.6]; v1 = 100*t1; v2 = 10*ones(1,length(t2)); v3 = -100*(t3-0.4)+10; v4 = zeros(1,length(t4)); t = [t1,t2,t3,t4]; 8-50 v = [v1,v2,v3,v4]; subplot(2,1,1) plot(t,v),axis([0 0.6 0 12]),axis([0 .6 0 12]),xlabel(’Time (secs)’),... ylabel(’Applied Voltage (volts)’) R = 0.6;L = 0.002;c = 0; KT = 0.04;Ke = 0.04;I = 6e-5; A = [-R/L,-Ke/L;KT/I,-c/I]; B = [1/L;0]; C = [0,1]; D = 0; sys = ss(A,B,C,D); [y, t] = lsim(sys,v,t); subplot(2,1,2) plot(t,y),axis([0 .6 0 300]),xlabel(’Time (secs)’),... ylabel(’Speed (rad/sec)’) The plots are shown in the figure. Applied Voltage (volts) 12 10 8 6 4 2 0 0 0.1 0.2 0.3 Time (secs) 0.4 0.5 0 0.1 0.2 0.3 Time (secs) 0.4 0.5 300 Speed (rad/sec) 250 200 150 100 50 0 Figure : for Problem 8.37. 8-51 38. The square function cannot be used here because it creates a periodic square wave, and we need a single square pulse. The script file is sys = tf(1,[0.1,1]); t = [0:0.001:1]; u = 10*(stepfun(t,0)-stepfun(t,0.2)); [y, t] = lsim(sys,u,t); plot(t,y,t,u),axis(([0 0.7 0 12]),xlabel(’Time (secs)’),... ylabel(’Capacitor Voltage (volts)’) The plot is shown in the figure. 12 Capacitor Voltage (volts) 10 8 6 4 2 0 0 0.1 0.2 0.3 0.4 Time (secs) 0.5 Figure : for Problem 8.38. 8-52 0.6 2.5 2 1.5 1 y 0.5 0 −0.5 −1 −1.5 −2 −2.5 0 500 1000 1500 t 2000 2500 3000 Figure : for Problem 8.39. 39. Put the model in state variable form as follows. Let x1 = y and x2 = ẏ. ẋ1 = x2 ẋ2 = −x1 + µ(1 − x21 )x2 Create the following function file. function xdot = vand1(t,x); mu = 1000; xdot = [x(2); -x(1) + mu*(1-x(1)^2)*x(2)]; The following script file uses the ode23s function. t, x] = ode23s(’vand1’, [0, 3000], [2, 0]); plot(t,x(:,1)),xlabel(’t’),ylabel(’y’) The plot is shown in the figure. The function ode45 fails to converge to a solution for this problem, but it can obtain a solution for “nonstiff” values of µ, such as µ = 1. 8-53 40. The approach is similar to that followed in the text, except that here the model is fourth order, and we must solve the equations over three time intervals instead of two. The file throwode.m plays the role of the file ballode.m in the text. The file bounce.ode calls the ode45 solver and plots the response. The equations of motion are ḧ = −g ẍ = 0 where h(t) is the ball’s height and x(t) is its horizontal displacement. The given initial values are h(0) = x(0) = 0, ḣ(0) = 30 sin 30◦ , ẋ(0) = 30 cos 30◦ . To put the model into state variable form, let y1 = h, y2 = ḣ, y3 = x, and y4 = ẋ. Then ẏ2 = −g ẏ1 = y2 ẏ3 = y4 ẏ4 = 0 and y1 (0) = y3 (0) = 0, y2 (0) = 30 sin 30◦ , and y4 (0) = 30 cos 30◦ . % file throwode.m function[value,isterminal,direction] = throwode(t,y,flag) if(nargin<3)|isempty(flag) value = [y(2);-9.81;y(4);0]; elseif flag == ’events’ value = y; isterminal = [1;0;0;0]; direction = [-1;0;0;0]; else error([’unknown flag’’’flag’’’.’]); end In the following file, note that we must update the initial conditions after each bounce because the ball is translating horizontally as well as vertically. The variables SV and SH are the vertical and horizontal components of the initial velocity. % bounce.m options = odeset(’Events’,’on’); SV = 30*sin(30*pi/180); SH = 30*cos(30*pi/180); [t1,y1] = ode45(’throwode’,[0,10],[0,SV,0,SH],options); [t2,y2] = ode45(’throwode’,[t1(length(t1)),10],... [0,-0.8*y1(length(t1),2),SH*t1(length(t1)),SH],options); [t3,y3] = ode45(’throwode’,[t2(length(t2)),10],... [0,-0.8*y2(length(t2),2),SH*t2(length(t2)),SH],options); t = [t1;t2;t3];y = [y1;y2;y3]; plot(y(:,3),y(:,1)),axis([0 200 0 200]),xlabel(’Distance (m)’),... 8-54 12 10 Height (m) 8 6 4 2 0 0 20 40 60 80 100 120 Distance (m) 140 Figure : for Problem 8.40. ylabel(’Height (m)’) The plot is shown in the figure. 8-55 160 180 200 Figure : for Problem 8.41. 41. The figure shows the Simulink digram for the sine wave input. 8-56 Figure : for Problem 8.42. 42. The figure shows the Simulink digram. Note that initial values were not specified for y and ẏ. Nonzero values for these can be specified as the initial conditions of the two integrators. Their values will affect the simulation results. 8-57 Figure : for Problem 8.43. 43. The figure shows the Simulink digram. Note that the given value of Q = 10 might not be large enough to keep the temperature between 69◦ and 71◦ . 8-58