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.

James Carter
Contributor
4.6
60
5 months ago
Preview (11 of 35 Pages)
100%
Purchase to unlock

Page 1

Introduction to MATLAB, 4th Edition Solution Manual - Page 1 preview image

Loading page image...

1Introduction to MATLAB, Fourth Editionby Delores M. EtterSolution ManualChapter 11.F2.T3.F4.T5.F6.F7.F8.F9.T10.T11.T12.F13.F14.T15.T16.F17.F18.F19.F20.T21.(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.program35.hardware36.CPU37.output devices38.system software39.algorithm40.compilation41.spreadsheet42.syntax or grammar43.operating system44.ALU45.debugging46.logic errors47.utilities48.microprocessor49.word processor50.machine language51.average = 14.2667%-----------------------------------------------------%Solutionto1.51%Thisprogramcomputestheaveragepressure%andthenplotsthepressuredata.%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('PressureMeasurements'),xlabel('Time,seconds'),ylabel('Pressure,psi'),grid%-----------------------------------------------------

Page 2

Introduction to MATLAB, 4th Edition Solution Manual - Page 2 preview image

Loading page image...

Page 3

Introduction to MATLAB, 4th Edition Solution Manual - Page 3 preview image

Loading page image...

2Chapter 21.not legal2.not legal3.legal4.legal5.legal6.not legal7.not legal8.legal9.not legal10.not legal11.legal12.valid function names:global,help,sin,input13.1.7514.6015.6016.7517.15,62518.919.120.5^221.(5+3)/(5*6)22.(4+6^3)^0.523.9*(6/12)+7*5^(3+2)24.1+5*3/(6*6)+2^(2-4)*1/5.525.r=5;area=pi*r*r26.r=10;surface=4*pi*r*r27.r=2;vol=4/3*pi*r^328.r=3;h=[1,5,12];vol=pi*r*r*h

Page 4

Introduction to MATLAB, 4th Edition Solution Manual - Page 4 preview image

Loading page image...

329.h=12;b=[2,4,6];area=0.5*b*h30.h=12;b=[2,4,6];area=0.5*b*h;vol=area*1031.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(:)’;

Page 5

Introduction to MATLAB, 4th Edition Solution Manual - Page 5 preview image

Loading page image...

445.%-----------------------------------------------------%Solutionto2.45%Thisprogramestimatestimerequiredforastride,%givenL,thelengthofaleginfeet.%%AstridetakesTs=T/2seconds,%whereT=2pisqrt(2L/(3g))%g=32ft/(s^2)%sqrt(x)=(x)^0.5L=input('Inputlengthofaleginfeet:');Ts=pi*(2*L/(3*32))^0.5%------------------------------------------------------Chapter 31.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(‘maxrangeandcorrespondingangleinradians’)[max_R,max_theta]3.b=2:10;logb=log(10)./log(b);display(‘baseandlogof10tothespecifiedbase’)[b’,logb’]4.P0=100;r=0.9;t=10;P=P0*exp(r*t);display(‘rabbitsatendof10years’)P

Page 6

Introduction to MATLAB, 4th Edition Solution Manual - Page 6 preview image

Loading page image...

55.Q=8000;R=1.987;k0=1200;T=100:50:500;k=k0*exp(-Q./(R*T));display(‘temperature(K)andreactionrates’)[T’,k’]6.G=[68,83,70,75,82,57,5,76,85,62,71,96,78,76,72,75,83,93];display(‘mean,medianstandarddeviation,count’];[mean(G)median(G)std(G)length(G)]most typical value is the median because it represents one of the values7.x=23.5*randn(1,10000)+80;display(‘meanandstandarddeviation’)[mean(x)std(x)]8.t=0:2:100;ht=2.13*t.^20.0013*t.^4+0.000034*t.^4.751;display(‘timeandheight’)[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.datextension.loadsensor.dat[n_rows,n_cols]=size(sensor);display(‘Numberofsensors:’)n_colsdisplay(‘Numberofseconds:’)n_rows12.(assumes statements from solution to problem 11)[max_s,n]=max(sensor);k=1:n_row;display(‘sensornumber,maxvalue,correspondingtime(s)’)[k’,max_s’,(n-1)’]

Page 7

Introduction to MATLAB, 4th Edition Solution Manual - Page 7 preview image

Loading page image...

613.(assumes statements from solution to problem 11)mean_s=mean(sensor);std_s=std(sensor);mean_all=mean(sensor(:));std_all=std(sensor(:));display(‘sensornumber,mean,standarddeviation’)[k’,mean_s’,std_s’]display(‘overallmeanandstandarddeviation’)[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(‘maximumandminimumtemperatures’)[max(temps),min(temps]17.%-----------------------------------------------------%Solutionto3.17%Thisprogramestimatestheageofanartifact,%basedontheproportionofcarbon14remaining.%%ageinyears=-ln(carbon14proportionremaining)/0.0001216C14prop=input('proportionofcarbon14remaining:');age_years=-log(C14prop)/0.0001216;fprintf('Estimatedageis%8.2fyears\n',age_years);%------------------------------------------------------18.%-----------------------------------------------------%Solutionto3.18C14prop=input('proportionofcarbon14remaining:');age_centuries=-log(C14prop)/0.01216;fprintf('Estimatedageis%8.2fcenturies\n',age_centuries);%------------------------------------------------------19.%-----------------------------------------------------%Solutionto3.19C14prop=input('proportionofcarbon14remaining:');age_years=-log(C14prop)/0.0001216;fprintf('Estimatedageis%dyears,rounded\n',age_years);%------------------------------------------------------

Page 8

Introduction to MATLAB, 4th Edition Solution Manual - Page 8 preview image

Loading page image...

720.%-----------------------------------------------------%Solutionto3.20%proportionofCarbon14remaining=%exp(-(ageinyears)*0.0001216)age_years=input('ageofartifact,inyears:');C14prop=exp(-age_years*0.0001216);fprintf(‘ProportionofCarbon14is%4.2f\n',C14prop);%------------------------------------------------------21.%-----------------------------------------------------%Solutionto3.21C14prop1=input('artifact1proportionofcarbon14:');C14prop2=input('artifact2proportionofcarbon14:');age1_years=-log(C14prop1)/0.0001216;age2_years=-log(C14prop2)/0.0001216;age_diff=abs(age1_years-age2_years);fprintf('Agedifferenceis%dyears,rounded\n,round(age_diff));Chapter 41.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(‘HorizontalDistance’),xlabel(‘Time,s’),ylabel(‘m’),gridfigure(2)plot(t,vertical),title(‘VerticalDistance’),xlabel(‘Time,s’),ylabel(‘m’),grid2.assumesthestatementsinproblem1figure(3)plot(horizontal,vertical),title(‘ProjectileDistances’),xlabel(‘HorizontalDistance,m’),ylabel(‘VerticalDistance,m’),grid3.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(‘ProjectileDistances’),

Page 9

Introduction to MATLAB, 4th Edition Solution Manual - Page 9 preview image

Loading page image...

8xlabel(‘HorizontalDistance,m’),ylabel(‘VerticalDistance,m’),grid4.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(‘HorizontalDistance’),xlabel(‘Time,s’),ylabel(‘m’)subplot(2,2,2),plot(t,v2),title(‘VerticalDistance’),xlabel(‘Time,s’),ylabel(‘m’)subplot(2,2,3),plot(h2,v2),title(‘ProjectileDistances’),xlabel(‘HorizontalDistance,m’),ylabel(‘VerticalDistance,m’),gridsubplot(2,2,4),plot(h1,v1,’-‘,h2,v2,’—‘,h3,v3,’:’);legend(‘pi/3’,’pi/4’,’pi/6’);title(‘ProjectileDistances’),xlabel(‘HorizontalDistance,m’),ylabel(‘VerticalDistance,m’),grid5.P0=1000;rate=0.08;t=1:30;P=P0*exp(rate*t);plot(t,P),title(‘SavingsGrowth’),xlabel(‘Time,yrs’),ylabel(‘AccountBalance,$’),grid6.P0=1000;rate=0.08;t=1:30;P=P0*exp(rate*t);subplot(2,2,1),plot(t,P),title(‘SavingsGrowth’),xlabel(‘Time,yrs’),ylabel(‘AccountBalance,$’),grid,subplot(2,2,2),semilogx(t,P),title(‘SavingsGrowth’),xlabel(‘Time,yrs’),ylabel(‘AccountBalance,$’),grid,subplot(2,2,3),semilogy(t,P),title(‘SavingsGrowth’),xlabel(‘Time,yrs’),ylabel(‘AccountBalance,$’),grid,subplot(2,2,4),loglog(t,P),title(‘SavingsGrowth’),xlabel(‘Time,yrs’),ylabel(‘AccountBalance,$’),grid(rectangular coordinate system is best for this data)

Page 10

Introduction to MATLAB, 4th Edition Solution Manual - Page 10 preview image

Loading page image...

97.G=[68,83,61,70,75,82,57,51,76,85,62,...71,96,78,76,68,72,75,83,93];display(‘SortedValues’],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(‘QualityGrades’),legend(‘A’,’B’,’C’,’D’,’F’)10.useInsertTextBoxtoentertextineachpieslice11.quality=[2,4,8,4,2];pie3(quality),title(‘QualityGrades’),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(‘plotofy’),xlabel(‘x,radians’),ylabel(‘y’),grid13.assumes computation of x, y, z in problem 12polar(x,y),title(‘polarplotofy’),xlabel(‘x,radians’),ylabel(‘y’)14.assumes computation of x, y, z in problem 12plot3(x,y,z),title(‘3DPlot’),xlabel(‘x’),ylabel(‘y’),zlabel(‘z’),grid15.assumes computation of x, y, z in problem 12plot3(z,y,x),title(‘TornadoPlot’),xlabel(‘x’),ylabel(‘y’),zlabel(‘z’),grid16.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(‘PeakFunction’),xlabel(‘x’),ylabel(‘y’),grid17.assumes computations in problem 16subplot(1,2,1),surf(z),title(‘PeakFunction’),xlabel(‘x’),ylabel(‘y’),gridsubplot(1,2,2),surf(new_x,new_y,z),title(‘PeakFunction’),xlabel(‘x’),ylabel(‘y’),grid

Page 11

Introduction to MATLAB, 4th Edition Solution Manual - Page 11 preview image

Loading page image...

1018.assumes computations in problem 16subplot(1,2,1),surf(new_x,new_y,z),shadinginterp,colormap(flag),title(‘PeakFunction’),xlabel(‘x’),ylabel(‘y’),gridsubplot(1,2,2),surf(new_x,new_y,z),shadinginterp,colormap(prism),title(‘PeakFunction’),xlabel(‘x’),ylabel(‘y’),grid19.assumes computations in problem 16contour(new_x,new_y,z),title(‘ContourPlot’),xlabel(‘x’),ylabel(‘y’),grid20.assumes computations in problem 16surfc(new_x,new_y,z),title(CombinationSurface/ContourPlot’),xlabel(‘x’),ylabel(‘y’),grid21.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, 422.x=-5:0.1:5;g2=x.^2-4*x+4;plot(x,g2);xlabel('x'),ylabel('g2'),grid;root at 2(2ndorder, 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 roots24.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
Preview Mode

This document has 35 pages. Sign in to access the full document!

Study Now!

XY-Copilot AI
Unlimited Access
Secure Payment
Instant Access
24/7 Support
Document Chat

Document Details

Related Documents

View all