HW3 Palm Chapter 2 (17, 18, 21, 22, 23, 35, 40).
Dr. Tim Placek - placetd@auburn.edu
Contents
Prob 17
clear, clc, format compact, format short g % part (a) d1 = [-60,-25,30]; d2 = [-30,-55,20]; magD1 = norm(d1) % part (b) D = d2 - d1 % part (c) magD = norm(D) % So diver 1 is 71.5891 ft from the starting point. % To get to diver 2, diver 1 must swim 30 ft west, 30 ft south, % and 10 ft up. To reach diver 2 in a straight line, diver 1 must swim % 43.589 ft.
magD1 = 71.589 D = 30 -30 -10 magD = 43.589
Prob 18
clear, clc, format compact, format short g force = [11,7,8,10,9]; k = [1000,600,900,1300,700]; x = force./k % distance (compression) unit meters energy = 0.5*k.*x.^2 % energy unit joule
x = 0.011 0.011667 0.0088889 0.0076923 0.012857 energy = 0.0605 0.040833 0.035556 0.038462 0.057857
Prob 21
clear, clc, format compact, format short g r = [2:0.01:10]; V = 500; h = @(r) (V-2*pi*r.^3/3)./(pi*r.^2); cost = 600*pi*r.*h(r)+800*pi*r.^2; plot(r,cost) xlabel('Radius (meters)') ylabel('Cost ($)') [radius,mincost] = ginput(1) hmin = (V-2*pi*radius.^3/3)./(pi*radius.^2) % min cost found using fminbnd hcost = @(r) 600*pi*r.*h(r)+800*pi*r.^2; mincost_using_fminbnd = fminbnd(hcost,4,6)
radius = 4.9032 mincost = 91126 hmin = 3.3512 mincost_using_fminbnd = 4.9237
Prob 22
clear, clc, format compact, format short g % f = 1./sqrt(2*pi*c./x); % E = (x + w./(y + z))./(x + w./(y - z)); % A = exp(-c./(2*x))./(log(y).*sqrt(d*z)); % S = x.*(2.15 + 0.35*y).^1.8./(z.*(1-x).^y);
Prob 23(a)
%C(t) = 0.5C(0) implies that 0.5 = e?kt. Solve for t: t = ?(ln 0.5)/k. clear, clc, format compact, format short g k = [0.047:0.001:0.107]; thalf = @(k) -log(0.5)./k; plot(k,thalf(k)) xlabel('Elimination Rate Constant (h^1)') ylabel('Half-Life (h)')
Prob 23(b)
clear, clc, format compact, format short g a = 1; k = [0.047:0.001:0.107]; C = a*(1 - exp(-k))./k; plot(k,C) xlabel('Elimination Rate Constant (1/h)') ylabel('Concentration (dimensionless)')
Prob 35
clear, clc, format compact, format short g p1 = [3,-6,8,4,90]; p2 = [3, 5, -8, 70]; x=[-3:0.01:3]; y = polyval(p1,x); z = polyval(p2,x); plot(x,y,x,z,'--') xlabel('x') ylabel('y and z') gtext('y') gtext('z')
Prob 40
arrange as PV^2(V ? b) = RT V^2 ? a(V ? b) put in function form: PV^3 - (Pb + RT) V^2 + aV - ab = 0
clear, clc, format compact, format short g P = 0.95; T = 300; R = 0.08206; a = 6.49; b = 0.0562; idealV = R*T/P waalsV = roots([P,-(P*b + R*T),a,-a*b])
idealV = 25.914 waalsV = 25.705 0.18403 0.081164