Skip to content
Textbook Guides

Introduction to MATLAB, 4th Edition Solution Manual

Need help with textbook problems? Introduction to MATLAB, 4th Edition Solution Manual has all the answers and solutions to get you through.

Preview 11 of 35 pages

See the first 11 pages exactly as they appear in the document.

  1. Page 1
    Read page 1 as text

    1 Introduction to MATLAB, Fourth Edition by Delores M. Etter Solution Manual Chapter 1 1. F 2. T 3. F 4. T 5. F 6. F 7. F 8. F 9. T 10. T 11. T 12. F 13. F 14. T 15. T 16. F 17. F 18. F 19. F 20. T 21. (d) 22. (b) 23. (c) 24. (a) 25. (a) 26. (b) 27. (e) 28. (c) 29. (d) 30. (c) 31. (a) 32. (b) 33. (c) 34. program 35. hardware 36. CPU 37. output devices 38. system software 39. algorithm 40. compilation 41. spreadsheet 42. syntax or grammar 43. operating system 44. ALU 45. debugging 46. logic errors 47. utilities 48. microprocessor 49. word processor 50. machine language 51. average = 14.2667 %----------------------------------------------------- % Solution to 1.51 % This program computes the average pressure % and then plots the pressure data. % time = [0,1,2,3,4,5]; pressure = [14.6, 14.0, 14.2, 14.3, 14.1, 14.4]; average = mean(pressure) plot(time,pressure), title('Pressure Measurements'), xlabel('Time, seconds'), ylabel('Pressure, psi'), grid %-----------------------------------------------------

  2. Page 2
  3. Page 3
    Read page 3 as text

    2 Chapter 2 1. not legal 2. not legal 3. legal 4. legal 5. legal 6. not legal 7. not legal 8. legal 9. not legal 10. not legal 11. legal 12. valid function names: global, help, sin, input 13. 1.75 14. 60 15. 60 16. 75 17. 15,625 18. 9 19. 1 20. 5^2 21. (5+3)/(5*6) 22. (4+6^3)^0.5 23. 9*(6/12)+7*5^(3+2) 24. 1+5*3/(6*6)+2^(2-4)*1/5.5 25. r = 5; area = pi*r*r 26. r = 10; surface = 4*pi*r*r 27. r = 2; vol = 4/3*pi*r^3 28. r = 3; h = [1,5,12]; vol = pi*r*r*h

  4. Page 4
    Read page 4 as text

    3 29. h = 12; b = [2,4,6]; area = 0.5*b*h 30. h = 12; b = [2,4,6]; area = 0.5*b*h; vol = area*10 31. x = linspace(1,20,20); 32. x = linspace(0,2*pi,200); 33. x = linspace(4,20,15); 34. d = 0:10:360; r = d*2*pi/360; 35. cm = 0:2:50; inch = cm/2.54; 36. mph = linspace(0,100,14); fps = mph*5280/(60*60); 37. t = 0:2:100; g = 9.8; d = 0.5*g*t.*t; 38. mass1 = 6e24; mass2 = 7.4e22; r = 3.9e8; G = 6.673e-11; F = G*m1*m2/(r*r); 39. mass1 = 6e24; mass2 = 7.4e22; r = linspace(3.8e8,4e8,10); G = 6.673e-11; F = G*m1*m2/(r.*r); 40. B = A(:,1); 41. C = A(2,:); 42. D = A(:,1:3); 43. x = A(:,2:4); F = x(:); 44. x = A(:,2:4); G = x(:)’;

  5. Page 5
    Read page 5 as text

    4 45. %----------------------------------------------------- % Solution to 2.45 % This program estimates time required for a stride, % given L, the length of a leg in feet. % % A stride takes Ts=T/2 seconds, % where T = 2 pi sqrt(2L/(3g)) % g = 32 ft/(s^2) % sqrt(x) = (x)^0.5 L = input('Input length of a leg in feet:'); Ts = pi *(2*L/(3*32))^0.5 %------------------------------------------------------ Chapter 3 1. angle = 0:0.1:2*pi; sine = sin(angle); cosine = cos(angle); tangent = tan(angle); display(‘angle(radians), sine, cosine, tangent’); [angle’, sine’, cosine’, tangent’] 2. g = 9.9; v = 100; k = v*v/g; theta = 0:0.05:pi/2; R = k*sin(2*theta); [max_R,n] = max(R); max_theta = theta(n); display(‘max range and corresponding angle in radians’) [max_R, max_theta] 3. b = 2:10; logb = log(10)./log(b); display(‘base and log of 10 to the specified base’) [b’, logb’] 4. P0 = 100; r = 0.9; t = 10; P = P0*exp(r*t); display(‘rabbits at end of 10 years’) P

  6. Page 6
    Read page 6 as text

    5 5. Q = 8000; R = 1.987; k0 = 1200; T = 100:50:500; k = k0*exp(-Q./(R*T)); display(‘temperature(K) and reaction rates’) [T’, k’] 6. G = [68,83,70,75,82,57,5,76,85,62,71,96,78,76,72,75,83,93]; display(‘mean, median standard deviation, count’]; [mean(G) median(G) std(G) length(G)] most typical value is the median because it represents one of the values 7. x = 23.5*randn(1,10000) + 80; display(‘mean and standard deviation’) [mean(x) std(x)] 8. t = 0:2:100; ht = 2.13*t.^2 – 0.0013*t.^4 + 0.000034*t.^4.751; display(‘time and height’) [t’, ht’] 9. (assumes statements from solution to problem 8) [max_ht, n] = max(ht) 10. (assumes statements from solution to problem 8 and 9) max_time = t(n) 11. A simple way to create the data file is to use the Notebook application, and store the file using a .dat extension. load sensor.dat [n_rows, n_cols] = size(sensor); display(‘Number of sensors:’) n_cols display(‘Number of seconds:’) n_rows 12. (assumes statements from solution to problem 11) [max_s,n] = max(sensor); k = 1:n_row; display(‘sensor number, max value, corresponding time(s)’) [k’, max_s’, (n-1)’]

  7. Page 7
    Read page 7 as text

    6 13. (assumes statements from solution to problem 11) mean_s = mean(sensor); std_s = std(sensor); mean_all = mean(sensor (:)); std_all = std(sensor (:)); display(‘sensor number, mean, standard deviation’) [k’, mean_s’, std_s’] display(‘overall mean and standard deviation’) [mean_all, std_all] 14. temps = 2*randn(1,121)+70; 15. (assumes statement from solution to problem 14) time = 1:120; plot(time,temps) 16. (assumes statement from solution to problem 14) display(‘maximum and minimum temperatures’) [max(temps), min(temps] 17. %----------------------------------------------------- % Solution to 3.17 % This program estimates the age of an artifact, % based on the proportion of carbon 14 remaining. % % age in years = - ln(carbon 14 proportion remaining)/0.0001216 C14prop = input('proportion of carbon 14 remaining:'); age_years = - log(C14prop)/0.0001216; fprintf('Estimated age is %8.2f years\n', age_years); %------------------------------------------------------ 18. %----------------------------------------------------- % Solution to 3.18 C14prop = input('proportion of carbon 14 remaining:'); age_centuries = - log(C14prop)/0.01216; fprintf('Estimated age is %8.2f centuries\n', age_centuries); %------------------------------------------------------ 19. %----------------------------------------------------- % Solution to 3.19 C14prop = input('proportion of carbon 14 remaining:'); age_years = - log(C14prop)/0.0001216; fprintf('Estimated age is %d years, rounded\n', age_years); %------------------------------------------------------

  8. Page 8
    Read page 8 as text

    7 20. %----------------------------------------------------- % Solution to 3.20 % proportion of Carbon 14 remaining = % exp(-(age in years)*0.0001216) age_years = input('age of artifact,in years: '); C14prop = exp(- age_years * 0.0001216); fprintf(‘Proportion of Carbon 14 is %4.2f \n', C14prop); %------------------------------------------------------ 21. %----------------------------------------------------- % Solution to 3.21 C14prop1 = input('artifact 1 proportion of carbon 14:'); C14prop2 = input('artifact 2 proportion of carbon 14:'); age1_years = - log(C14prop1)/0.0001216; age2_years = - log(C14prop2)/0.0001216; age_diff = abs(age1_years - age2_years); fprintf('Age difference is %d years, rounded\n, round(age_diff)); Chapter 4 1. v0 = 100; angle = pi/4; g = 9.8; t = 0:0.1:20; horizontal = t*v0*cos(angle); vertical = t*v0*sin(angle) - 0.5*g*t.*t; figure(1) plot(t,horizontal),title(‘Horizontal Distance’), xlabel(‘Time, s’), ylabel(‘m’),grid figure(2) plot(t,vertical),title(‘Vertical Distance’), xlabel(‘Time, s’),ylabel(‘m’),grid 2. assumes the statements in problem 1 figure(3) plot(horizontal,vertical),title(‘Projectile Distances’), xlabel(‘Horizontal Distance, m’), ylabel(‘Vertical Distance, m’),grid 3. v0 = 100; g = 9.8; t = 0:0.1:20; h1 = t*v0*cos(pi/3); h2 = t*v0*cos(pi/4); h3 = t*v0*cos(pi/6); v1 = t*v0*sin(pi/3) – 0.5*g*t.*t; v2 = t*v0*sin(pi/4) – 0.5*g*t.*t; v3 = t*v0*sin(pi/6) – 0.5*g*t.*t; figure(4) plot(h1,v1,’-‘,h2,v2,’—‘,h3,v3,’:’); legend(‘pi/2’,’pi/4’,’pi/6’); title(‘Projectile Distances’),

  9. Page 9
    Read page 9 as text

    8 xlabel(‘Horizontal Distance, m’), ylabel(‘Vertical Distance, m’),grid 4. v0 = 100; g = 9.8; t = 0:0.1:20; h1 = t*v0*cos(pi/3); h2 = t*v0*cos(pi/4); h3 = t*v0*cos(pi/6); v1 = t*v0*sin(pi/3) – 0.5*g*t.*t; v2 = t*v0*sin(pi/4) – 0.5*g*t.*t; v3 = t*v0*sin(pi/6) – 0.5*g*t.*t; figure(5) subplot(2,2,1), plot(t,h2),title(‘Horizontal Distance’), xlabel(‘Time, s’), ylabel(‘m’) subplot(2,2,2),plot(t,v2),title(‘Vertical Distance’), xlabel(‘Time, s’),ylabel(‘m’) subplot(2,2,3),plot(h2,v2),title(‘Projectile Distances’), xlabel(‘Horizontal Distance,m’), ylabel(‘Vertical Distance, m’),grid subplot(2,2,4),plot(h1,v1,’-‘,h2,v2,’—‘,h3,v3,’:’); legend(‘pi/3’,’pi/4’,’pi/6’); title(‘Projectile Distances’), xlabel(‘Horizontal Distance, m’), ylabel(‘Vertical Distance, m’),grid 5. P0 = 1000; rate = 0.08; t = 1:30; P = P0*exp(rate*t); plot(t,P),title(‘Savings Growth’),xlabel(‘Time, yrs’), ylabel(‘Account Balance, $’),grid 6. P0 = 1000; rate = 0.08; t = 1:30; P = P0*exp(rate*t); subplot(2,2,1),plot(t,P),title(‘Savings Growth’), xlabel(‘Time, yrs’),ylabel(‘Account Balance, $’),grid, subplot(2,2,2),semilogx(t,P),title(‘Savings Growth’), xlabel(‘Time, yrs’), ylabel(‘Account Balance, $’),grid, subplot(2,2,3),semilogy(t,P),title(‘Savings Growth’), xlabel(‘Time, yrs’), ylabel(‘Account Balance, $’),grid, subplot(2,2,4),loglog(t,P), title(‘Savings Growth’), xlabel(‘Time, yrs’), ylabel(‘Account Balance, $’),grid ( rectangular coordinate system is best for this data)

  10. Page 10
    Read page 10 as text

    9 7. G = [68,83,61,70,75,82,57,51,76,85,62,... 71,96,78,76,68,72,75,83,93]; display(‘Sorted Values’], Gs = sort(G) bar(G),title(‘Scores’) 8. G = [68,83,61,70,75,82,57,51,76,85,62,... 71,96,78,76,68,72,75,83,93]; hist(G),title(‘Scores’) 9. quality = [2,4,8,4,2]; pie(quality),title(‘Quality Grades’), legend(‘A’,’B’,’C’,’D’,’F’) 10. use Insert → TextBox to enter text in each pie slice 11. quality = [2,4,8,4,2]; pie3(quality),title(‘Quality Grades’), legend(‘A’,’B’,’C’,’D’,’F’) 12. x = 0:pi/100:20*pi; y = x.*sin(x); z = x.*cos(x); plot(x,y),title(‘plot of y’), xlabel(‘x, radians’),ylabel(‘y’),grid 13. assumes computation of x, y, z in problem 12 polar(x,y),title(‘polar plot of y’), xlabel(‘x,radians’),ylabel(‘y’) 14. assumes computation of x, y, z in problem 12 plot3(x,y,z),title(‘3D Plot’), xlabel(‘x’),ylabel(‘y’),zlabel(‘z’),grid 15. assumes computation of x, y, z in problem 12 plot3(z,y,x),title(‘Tornado Plot’), xlabel(‘x’),ylabel(‘y’),zlabel(‘z’),grid 16. x = linspace(-3,3,100); y = linspace(-3,3,100); [new_x,new_y] = meshgrid(x,y); z = peaks(100); mesh(new_x,new_y,z),title(‘Peak Function’), xlabel(‘x’),ylabel(‘y’),grid 17. assumes computations in problem 16 subplot(1,2,1),surf(z),title(‘Peak Function’), xlabel(‘x’),ylabel(‘y’),grid subplot(1,2,2),surf(new_x,new_y,z),title(‘Peak Function’), xlabel(‘x’),ylabel(‘y’),grid

  11. Page 11
    Read page 11 as text

    10 18. assumes computations in problem 16 subplot(1,2,1),surf(new_x,new_y,z),shading interp,colormap(flag), title(‘Peak Function’),xlabel(‘x’), ylabel(‘y’),grid subplot(1,2,2),surf(new_x,new_y,z),shadinginterp,colormap(prism), title(‘Peak Function’),xlabel(‘x’), ylabel(‘y’),grid 19. assumes computations in problem 16 contour(new_x,new_y,z),title(‘Contour Plot’), xlabel(‘x’),ylabel(‘y’),grid 20. assumes computations in problem 16 surfc(new_x,new_y,z),title(Combination Surface/Contour Plot’), xlabel(‘x’),ylabel(‘y’),grid 21. x = -5:0.1:5; g1 = x.^3 - 5*x.^2 + 2*x + 8; plot(x,g1); xlabel('x'), ylabel('g1'), grid; roots at -1, 2, 4 22. x = -5:0.1:5; g2 = x.^2 - 4*x + 4; plot(x,g2); xlabel('x'), ylabel('g2'), grid; root at 2 ( 2 nd order, or double root) 23. x = -5:0.1:5; g3 = x.^2 - 2*x + 2; plot(x,g3); xlabel('x'), ylabel('g3'), grid; no real roots 24. x = -5:0.1:5; g4 = x.^5 - 3*x.^4 - 11*x.^3 + 27*x.^2 + 10*x - 24; plot(x,g4); xlabel('x'), ylabel('g4'), grid; roots at -3, -1, 1, 2, 4

24 more pages in the full document

Unlock it once and it stays in your library, ready to chat with or turn into flashcards.

Unlock the full document
See all

Study this document with CramX

Once it is in your library, every tool can work from it.