{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

palm_ch3

palm_ch3 - Solutions to Problems in Chapter Three Test Your...

This preview shows pages 1–7. Sign up to view the full content.

Solutions to Problems in Chapter Three Test Your Understanding Problems T3.1-1 The session is diary diary1.txt x = [1:5];y = [0:2:8]; x.*y ans = 0 4 12 24 40 save session1 clear x y load session1 x.*y ans = 0 4 12 24 40 diary off type diary1.txt x = [1:5];y = [0:2:8]; x.*y ans = 0 4 12 24 40 save session1 clear x y load session1 x.*y ans = 0 4 12 24 40 diary off T3.3-1 The script file is % script file rad_deg.m rad_angle = [1:5]; deg_angle = rad_angle*(180/pi); angle_table = format bank disp( 0 radians degrees 0 ) disp(angle_table) The session is 3-1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
rad_deg radians degrees 1.00 57.30 2.00 114.59 3.00 171.89 4.00 229.18 5.00 286.48 T3.3-2 The script file is % script file sphere_v.m format bank r = [1:.1:2]; V = 4*pi*r.^3/3; vol_table = [r 0 ,V 0 ]; disp( 0 radius volume 0 ) disp(vol_table) The session is sphere_v radius volume 1.00 4.19 1.10 5.58 1.20 7.24 1.30 9.20 1.40 11.49 1.50 14.14 1.60 17.16 1.70 20.58 1.80 24.43 1.90 28.73 2.00 33.51 T3.3-3 The script file is % script file sphere a.m r = input( 0 Enter a value for the radius: 0 ); A = 4*pi*r.^2; disp( 0 The area of the sphere is: 0 ) A 3-2
The session is sphere a Enter a value for the radius: 3 The area of the sphere is: A = 113.097 T3.4-1 The session is x = [5:20:85]; y = [10:30:130]; log(x.*y)-(log(x)+log(y)) ans = 1.0e-014 * -0.0444 0 -0.1776 -0.1776 0.1776 T3.4-2 The session is x = sqrt(2+6i) x = 2.0402 + 1.4705i abs(x) ans = 2.5149 angle(x) ans = 0.6245 real(x) ans = 2.0402 imag(x) ans = 1.4705 T3.4-3 The session is x = [0:.4:2*pi]; exp(i*x)-(cos(x)+i*sin(x)) The answers are essentially zero, which demonstrates that the identity is correct. 3-3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
T3.4-4 The session is x = [0:.4:2*pi]; asin(x)+acos(x)-pi/2 The answers are essentially zero, which demonstrates that the identity is correct. T3.4-5 The session is x = [0:.4:2*pi]; tan(2*x)-2*tan(x)./(1-tan(x).^2) The answers are essentially zero, which demonstrates that the identity is correct. T3.4-6 The session is x = [0:.1:5]; sin(i*x)-i*sinh(x) The answers are essentially zero, which demonstrates that the identity is correct. T3.5-1 The function file is function y = f5(x) y = exp(-.2*x).*sin(x+2)-.1; You can plot the function to obtain solution estimates to use with fzero , or you can simply try values of x between 0 and 10. The session is fzero( 0 f5 0 ,0) ans = 1.0187 fzero( 0 f5 0 ,4) ans = 4.5334 fzero( 0 f5 0 ,6) ans = 7.0066 So the solutions are x = 1 . 0187, 4.5334, and 7.0066. 3-4
T3.5-2 The function file is function y = f6(x) y = 1 + exp(-.2*x).*sin(x+2); You can plot the function to obtain solution estimates to use with fminbnd , or you can simply try values of x between 0 and 10. The session is fminbnd( 0 f6 0 ,0) ans = 2.5150 f6(ans) ans = 0.4070 fminbnd( 0 f6 0 ,10) ans = 8.7982 f6(ans) ans = 0.8312 So the solutions are ( x, y ) = (2 . 5150 , 0 . 4070) and ( x, y ) = (8 . 7982 , 0 . 8312). T3.5-3 Refer to Example 3.5-2. Modify the function file given in the example to use an area of 200 ft 2 rather than 100 ft 2 . The function file is function L = channel(x) L = 200./x(1)-x(1)./tan(x(2))+2*x(1)./sin(x(2)); Because this problem is similar to Example 3.5-1, we can try the same guess as in the example. The session is x = fminsearch( 0 channel 0 ,[20,1]) x = 10.7457 1.0472 The answer is d = 10 . 7457 ft and θ = 1 . 0472 radians, or 60 . T3.6-1 Using cell indexing to create a 1 × 4 cell array, the script file is: A { 1 } = [1:4]; A { 2 } = [0,9,2]; A { 3 } = [2:5]; 3-5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A { 4 } = [6:8]; [x,y] = deal(A { 1:2 } ); B = [x,y] C = [A { 2 } ;A { 4 } ] [u,v] = deal(A { 2:3 } ); D = min([u,v]) T3.7-1 The script file is student(1).name = 0 John Smith 0 ; student(1).SSN = 0 392-77-1786 0 ; student(1).email = 0 [email protected] 0 ; student(1).tests = [67,75,84]; student(2).name = 0
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}