chapter 4 solved problems - hvl hydrodynamikk...chapter 4: solved problems 5 6. a 300 lb garage door...

34
1 Chapter 4 Solved Problems 1. Body Mass Index (BMI) of a person is a measure of body fat based on height and weight. In US customary units it is calculated by: where W is the person’s weight in pounds and h is the heights in inches. Write a MATLAB program in a script file that calculates the BMI. For input the program asks the user to enter his/her weight and heights. The program then calculates the BMI rounded to the nearest tenth. For output the program displays the message: “The BMI is: XX.” where XX is the value of the BMI. Determine the BMI of a 68 in. tall person that weight162 lb. Solution Script file: W=input('Please enter your weight in pounds: '); h=input('Please enter your height in inches: '); BMI=round(703*W/h^2*10)/10; fprintf('The BMI is %4.1f\n',BMI) Command Window: Please enter your weight in pounds: 162 Please enter your height in inches: 68 The BMI is 24.6

Upload: others

Post on 08-Mar-2021

54 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

1

Chapter 4 Solved Problems

1. Body Mass Index (BMI) of a person is a measure of body fat based onheight and weight. In US customary units it is calculated by:

where W is the person’s weight in pounds and h is the heights in inches.Write a MATLAB program in a script file that calculates the BMI. Forinput the program asks the user to enter his/her weight and heights. Theprogram then calculates the BMI rounded to the nearest tenth. For outputthe program displays the message: “The BMI is: XX.” where XX is thevalue of the BMI. Determine the BMI of a 68 in. tall person that weight162lb.

Solution

Script file:

W=input('Please enter your weight in pounds: ');h=input('Please enter your height in inches: ');BMI=round(703*W/h^2*10)/10;fprintf('The BMI is %4.1f\n',BMI)

Command Window:

Please enter your weight in pounds: 162Please enter your height in inches: 68The BMI is 24.6

Page 2: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

2 Chapter 4: Solved Problems

2. The altitude, h, as a function of air pressure can be calculated by:

where h is in units of ft and the pressure p in units of millibars (mb). Write aMATLAB program in a script file that calculates the h for a given p. Forinput the program asks the user to enter the pressure in units of millibars.The program then calculates the altitude rounded to the nearest integer. Foroutput the program displays the message: “The altitude is: XX ft.” whereXX is the calculated value of h. Determine the altitude if the pressure is 394mb.

Solution

Script File:p=input('Please enter the enter the pressure in units of millibars: ');h=round(145366.45*(1-(p/1013.25)^0.190289));fprintf('The altitude is %4.0f ft.\n',h)

Command Window:Please enter the enter the pressure in units of

millibars: 394The altitude is 23915 ft.

3. Write a MATLAB program that determines the radius,r, of the largest sphere that can be inscribed inside acone with base radius R and height h. For input theprogram asks the user to enter values for R and h. Theprogram then calculates r rounded to the nearest tenth.For output the program displays the message: “Theradius of the largest sphere that can be inscribed insidea cone with a base radius of XX in. and heights of XXin. is: XX in.” where XX are the corresponding numerical values. Use theprogram to determine r for a cone with in. and in.

Solution

Script File:

R=input('Please enter the radius of the cone: ');h=input('Please enter the heigh of the cone: ');

h

R

r

Page 3: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 3

r=round(h*R/(sqrt(R^2+h^2)+R)*10)/10;fprintf('The radius of the largest sphere that can be inscribed inside a cone\n')fprintf('with a base radius of %5.1f in. and heights of%5.1f in. is: %5.1f in.\n',R,h,r)

Command Window:

Please enter the radius of the cone: 8Please enter the heigh of the cone: 22The radius of the largest sphere that can be inscribed inside a conewith a base radius of 8.0 in. and heights of 22.0 in. is: 5.6 in.

4. Radioactive decay can be modeled by the equation

where A is the amount at time t, A0 is the amount at time , and k is aconstant. Write a MATLAB program that calculates the amount of a radio-active material. When executed the program asks the user to enter the half-life of the material (in years), the current amount of the material (in lb), andthe number of years t from now for which amount should be calculated.From this information the program first calculates the constant k and thenthe amount at t years. For output the program displays the message: “Theamount of the material after XX years is XX kg” where XX are the corre-sponding numerical values. Use the program to determine how much pluto-nium-239 (half-life 24110 years) will be left from 50 lb after 500 years.

Solution

Script File:th=input('Please enter the half-life of the material (in years): ');A0=input('Please enter the current amount of the material (in lb): ');t=input('Please enter the number of years from now for which amount should be calculated: ');k=log(2)/th;A=A0*exp(-k*t);fprintf('The amount of the material after %7.1f years is

%6.3f lb\n',t,A)

Page 4: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

4 Chapter 4: Solved Problems

Command Window:

Please enter the half-life of the material (in years): 24110

Please enter the current amount of the material (in lb): 50

Please enter the number of years from now for which amount should be calculated: 500

The amount of the material after 500.0 years is 49.286 lb

5. A fuel tank is made of a half cylinder ( in.)as shown. Derive an expression for the amount offuel in gallons as a function of h. Create a vectorfor h ranging from 0 to 14 in. with increments of2 in. Then calculate the corresponding volumerounded to the nearest tenth of a gallon. Displaythe results in a two-column table where in thefirst column are the values of h and in the second column the associated val-ues of volume (in gallons).

SolutionScript File:

R=14;h=0:2:14;V=(R^2*acos((R-h)./R)-(R-h).*sqrt(2*R*h-h.^2))*36/231;V=round(V*10)/10;T=[h', V'];fprintf(' h (in.) V (gallons) \n')disp(T)

Command Window:

h (in.) V (gallons) 0 0 2.0000 3.0000 4.0000 8.4000 6.0000 15.1000 8.0000 22.6000 10.0000 30.8000 12.0000 39.3000 14.0000 48.0000

h

36 in r

Page 5: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 5

6. A 300 lb garage door is being opened bypulling on the cable as shown. As the dooris lifted the force, F, in the cable, as a func-tion of the angle θ, is given by:

where

Calculate F for θ=0° through 90° withincrements of 10°. Display the results in two-column table.

Solution

Script File:

q=0:10:90;a=asind((1+3*cosd(q))./sqrt((1+3*cosd(q)).^2+(3-3*sind(q)).^2));F=300*4.5*sind(q)./(3*cosd(a-q));T=[q', F'];fprintf(' Theta (deg) F (lb) \n')disp(T)

Command Window:

Theta (deg) F (lb) 0 0 10.00 116.59 20.00 209.31 30.00 283.11 40.00 341.08 50.00 385.26 60.00 417.07 70.00 437.57 80.00 447.84 90.00 450.00

Page 6: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

6 Chapter 4: Solved Problems

7. Write a MATLAB program in a script file that calculate the average and thestandard deviation of a list of grades as well as the number of grades on thelist. The program asks the user (input command) to enter the grades aselements of a vector. The program then calculates the required quantitiesusing MATLAB’s built-in functions length, mean, and std. The resultsare displayed in the Command Window in the following format:“There are XX grades.” where XX is the numerical value.“The average grade is XX.” where XX is the numerical value rounded to thenearest tenth.“The standard deviation is XX.” where XX is the numerical value roundedto the nearest tenth.Execute the program and enter the following grades: 93, 77, 51, 62, 99, 41,82, 77, 71, 68, 100, 46, 78, 80 and 83.

SolutionScript File:

grades=input('Please enter the grades as a vector [x x x]: ');number=length(grades);aver=round(mean(grades)*10)/10;standard_dev=round(std(grades)*10)/10;fprintf('\nThere are %i grades.\n',number)fprintf('The average grade is %.1f.\n',aver)fprintf('The standard deviation is %.1f.\n',stan-

dard_dev)

Command Window:

Please enter the grades as a vector [x x x]: [93 77 51 62 99 41 82 77 71 68 100 46 78 80 83]

There are 15 grades.The average grade is 73.9.The standard deviation is 17.9.

Page 7: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 7

8. The reduction of the amount of medication in the body can be modeled by

the equation , where A is the amount at time t, A0 is the amount at

t = 0, and k is the decay constant ( ). The half-life time is a certain med-ication is 3.5 hours. A person takes 400 mg of the medication at t=0, andthen additional 400 mg every 4 hours. Determine the amount of the medica-tion in a patient’s body 23 hours after taking the first dose.After determining the value of k, define a vector (thetime since taking each dose) and calculate the corresponding values of A.Then use MATLAB’s built-in function sum to determine the total amount.

Solution

Script File:k=-log(2)/3.5;t=[23:-4:3];A=sum(400*exp(k*t))

Command Window:

A = 400.1059

9. The value of a saving account, V, after t years is given by:

where P is the initial investment, r is the yearly interest rate in % (e.g., 7.5%entered as 7.5), and n is the number of times per year that the interest iscompounded. Write a MATLAB program in a script file that calculates V.When the program is executed it asks the user to enter the amount of the ini-tial investment, the number of years, the interest rate and the number oftimes per year that the interest is compounded. The output is displayed inthe following format: “The value of a $XX investment at a yearly interestrate of X.X% compounded X times per year, after XX years is$XXXX.XX”, where XXX stands for the corresponding quantities. Use theprogram to determine the value of a $20,000 investment after 18 years if theyearly interest rate is 3.5% compounded 6 time a year.

Solution

Script File:P=input('Please enter the amount of the initial investment($): ');

Page 8: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

8 Chapter 4: Solved Problems

t=input('Please enter the number of years: ');r=input('Please enter the interest rate (%): ');n=input('Please enter the he number of times per year that the interest is compounded: ');V=P*(1+r/100/n)^(n*t);disp(' '), disp(' ')fprintf('The value of a $%.2f investment at a yearly interest rate of %.2f%%\n',P,r) fprintf('compounded %.0f times per year after %.0f years

is $%.2f\n',n,t,V)

Command Window:

Please enter the amount of the initial investment($):20000

Please enter the number of years: 18Please enter the interest rate (%): 3.5Please enter the he number of times per year that the

interest is compounded: 6 The value of a $20000.00 investment at a yearly interest

rate of 3.50%compounded 6 times per year after 18 years is $37483.54

10. The electricity supply cables of the threehouses shown are connected to a pole asshown. Write a MATLAB program that deter-mines the location of the pole (distance x) thatminimizes the total length of the cablesneeded. In the program define a vector x withvalues ranging from 50 to 200 with incrementsof 0.1. Use this vector to calculate the corre-sponding values of total length of the cables. Then use MATLAB’s built-infunction min to find the value of x that corresponds to the shortest lengthof cables.

Solution

Script File:x=50:0.1:200;

x

210 ft

80 ft

80 ft

Page 9: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 9

L=x+2*sqrt((210-x).^2+80^2);[Lmin, n]=min(L)xOfLmin=x(n)

Command Window:

Lmin = 348.56n = 1139.00xOfLmin = 163.80

11. Early explorers often estimated altitude by measuring the temperature ofboiling water. Use the following two equations to make a table that modern-day hikers could use for the same purpose.

,

where p is atmospheric pressure in inches of mercury, is boiling tempera-ture in °F, and h is altitude in feet. The table should have two columns, thefirst altitude and the second boiling temperature. The altitude should rangebetween –500 ft and 10,000 ft at increments of 500 ft.

Solution

Script File:format short galt=-500:500:10000;p=29.921*(1-6.8753e-6*alt);Tb=49.16*log(p)+44.932;tbl=[alt' Tb'];disp(' Boiling')disp(' Altitude Temperature')disp(' (ft) (degF)')disp(tbl)

Command Window:

Boiling Altitude Temperature (ft) (degF) -500 212.17 0 212.01

Tb 49.161 pln 44.932+=

Tb

Page 10: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

10 Chapter 4: Solved Problems

500 211.84 1000 211.67 1500 211.5 2000 211.32 2500 211.15 3000 210.98 3500 210.81 4000 210.63 4500 210.46 5000 210.29 5500 210.11 6000 209.93 6500 209.76 7000 209.58 7500 209.4 8000 209.22 8500 209.04 9000 208.87 9500 208.68 10000 208.5

12. An isosceles triangle sign is designed to have atriangular printed area of 600 in.2 (shaded areawith a base length of a and height of h in the fig-ure). As shown in the figure, there is a 2-in. gapbetween the sides of the triangles. Write a MAT-LAB program that determine the dimensions aand h such that the overall area of the sign willbe as small as possible. In the program define avector a with values ranging from 10 to 120 withincrements of 0.1. Use this vector for calculatingthe corresponding values of h and the overall area of the sign. Then useMATLAB’s built-in function min to find the dimensions of the smallestsign.

Solution

Script File:

A=600;a=10:0.1:120;h=2*A./a;q=atand(a./(2*h));H=2+h+2./sind(q);

2 in.a

h

2 in.

2 in.

Page 11: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 11

B=2*H.*tand(q);AA=B.*H/2;[AAmin, i]=min(AA)amin=a(i)hmin=h(i)

Command Window:

AAmin = 844.1299i = 273amin = 37.2000hmin = 32.2581

13. The angle θ at which a viewer seesthe picture on the screen in amovie theater depends on the dis-tance x from the screen. Write aMATLAB program that deter-mines the angle θ (in degrees) forviewers setting at distances of 20, 26, 32, 38, 44, 50, 56 62 and 68 ft. Displaythe results in a two-column table.

SolutionScript File:x=20:6:68;a=atand((8-x*tand(8))./x);b=atand((30-x*tand(8))./x);th=b-a;tbl=[x' th'];disp(' Distance Angle')disp(' (ft) (deg)')disp(tbl)

Command Window: Distance Angle (ft) (deg) 20.0000 39.1171 26.0000 35.8893

Page 12: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

12 Chapter 4: Solved Problems

32.0000 32.3067 38.0000 28.9775 44.0000 26.0620 50.0000 23.5621 56.0000 21.4299 62.0000 19.6083 68.0000 18.0441

14. A 12 ft (144 in.) wire is cut into eight pieceswhich are welded together to form a pyramidas shown, such that in the rectangular base

. Write a MATLAB program thatdetermines the dimensions a and b such thatthe volume of the pyramid will be as large aspossible. In the program define a vector a withvalues ranging from 4 to 14 in. with incre-ments of 0.01 in. Use this vector for calculat-ing the corresponding values of b, h and thevolume. Then use MATLAB’s built-in function max to find the dimensionsof a and b that correspond to the pyramid with the largest volume.

Solution

Script File:L=144;a=4:0.01:14;b=1.9*a;S=(L-2*(a+b))/4;D=sqrt((a/2).^2+(b/2).^2);h=sqrt(S.^2-D.^2);V=a.*b.*h/3;[Vmax, i]=max(V)amax=a(i)bmax=b(i)

Command Window:

Vmax = 1.2466e+03i = 734

ab

h

Page 13: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 13

amax = 11.3300bmax = 21.5270

15. A person at point A spots a child introuble at point B across the river. Theperson can run at a speed of 8.6 ft/s andcan swim at a speed of 3.9 ft/s. In orderto reach the child in the shortest time theperson runs to point C and then swimsto point B, as shown. Write a MATLAB program that determines thedistance x to point C that minimizes the time the person can reach the child.In the program define a vector x with values ranging from 0 to 5,000 withincrements of 1. Use this vector to calculate the corresponding values ofx.Then use MATLAB’s built-in function min to find the value of x thatcorresponds to the shortest time.

Solution

Script File:s=10000; vr=8.6; vs=3.9;x=0:5000;D=sqrt(3000^2+x.^2);t=(10000-x)./vr+D./vs;[tmmin, i]=min(t)xmin=x(i)

Command Window:tmmin = 1.8484e+03i = 1527xmin = 1526

A

B

C

10,000 ft

x

3,000 ft

Page 14: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

14 Chapter 4: Solved Problems

16. The maximum stress σmax at the edgeof a hole (diameter d) in a thin plate,with width w and thickness t, loadedby a tensile force F as shown is givenby:

where and .

Write a program in a script file that calculates σmax. The program shouldread the values of F, w, d, and t from an ascii text file using the load com-mand. The output should be in the form of a paragraph combining text andnumbers,— i.e., something like: “The maximum stress in a plate with awidth of XX in. and thickness of XX in. and a hole of XX in. in diameter,due to a tensile force of XXX lb is XXXX psi, where XX stands for numeri-cal values. The stress should be rounded to the nearest integer. Use the pro-gram to calculate σmax when , in. in., and

lb.

Solution

Script File:load HW4_16_data.txtF=HW4_16_data(1); w=HW4_16_data(2); d=HW4_16_data(3); t=HW4_16_data(4);c=d/w;segN=F/(t*(w-d));Kt=3-3.14*c+3.667*c^2-1.527*c^3;segMax=Kt*segN;fprintf('The maximum stress in a plate with a width of %.2f in. \n',w)fprintf('and thickness of %.4f in. and a hole of %.3f in. in diameter, \n',t,d)fprintf('due to a tensile force of %.1f lb is %.1f

psi.\n',F,segMax)

Text File (HW4_16_data.txt):

8000 2.5 1.375 0.1875

Command Window:

The maximum stress in a plate with a width of 2.50 in. and thickness of 0.1875 in. and a hole of 1.375 in. in

FFd w

t

Page 15: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 15

diameter, due to a tensile force of 8000.0 lb is 80714.4 psi.

17. The airplane shown is flying at a constantspeed of mi/h along a straight path asshown. The airplane is being tracked by aradar station positioned a distance ftbelow point A. The airplane is at point A at

. Write a MATLAB program that calcu-lates θ and r as functions of time for

s. Display the results in athree-column table where the first column is t, the second is the angle θ indegrees, and the third is the corresponding value of r.

Solution

Script File:

format shortgv=350*5280/3600; h=1500;t=0:0.5:6;H=h+v*t*sind(10);X=v*t*cosd(10);r=sqrt(H.^2+X.^2);th=acosd(X./r);Table=[t' th' r'];disp(' t(s) th (deg) r(ft)')disp(Table)

Command Window:

t(s) th (deg) r(ft) 0 90 1500 0.5 80.706 1565.1 1 72.353 1667.6 1.5 65.101 1801.1 2 58.933 1959.3 2.5 53.737 2136.7 3 49.367 2328.9 3.5 45.682 2532.6

Page 16: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

16 Chapter 4: Solved Problems

4 42.556 2745.2 4.5 39.885 2964.7 5 37.588 3189.8 5.5 35.595 3419.4 6 33.856 3652.5

18. The intrinsic electrical conductivity σ of a semiconductor can be approxi-mated by:

where σ is measured in , is the band gap energy, k is Boltz-

mann’s constant ( ev/K), and T is temperature in kelvins. ForGermanium, and ev. Write a program in a script file

that calculates the intrinsic electrical conductivity for Germanium for vari-ous temperatures. The values of the temperature should be read from an xlsspreadsheet using the xlsread command. The output should be presentedas a table where the first column is the temperature and the second columnis the intrinsic electrical conductivity. Use the following values for tempera-ture: 400, 435, 475, 500, 520, and 545 K.

Solution

Script file:

clear, clc C=13.83; Eg=0.67; k=8.62e-5; T=xlsread('Germanium_data.xlsx'); sigma=exp(C-Eg./(2*k*T)); tbl=[T sigma]; disp(' Intrinsic') disp(' Temperature Conductivity') disp(' deg K (ohm-m)^-1') %can also use disp as shown in problem 11 fprintf(' %4.0f %5.1f\n',tbl')

Excel file:

Eg

C 13.83= Eg 0.67=

Page 17: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 17

Command Window:

Intrinsic Temperature Conductivity deg K (ohm-m)^-1 400 61.2 435 133.7 475 283.8 500 427.3 520 576.1 545 811.7

19. The pressure drop Δp in Pa for a fluid flow-ing in a pipe with a sudden increase indiameter is given by:

where ρ is the density of the fluid, v, the velocity of the flow, and d and D aredefined in the figure. Write a program in a script file that calculates the pres-sure drop Δp. When the script file is executed it request the user to input the

density in kg/m3, the velocity in m/s, and values of the non-dimensionalratio as a vector. The program displays the inputted values of ρ and vfollowed by a table with the values of in the first column and the cor-responding values of Δp in the second column.

Execute the program assuming flow of gasoline ( kg/m3) atm/s and the following ratios of diameters

.

Ddv

ρ 737=

v 5=

Page 18: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

18 Chapter 4: Solved Problems

Solution

Script file:clear,clcro=input('Enter the density of the fluid in kg/m^3 ');v=input('Enter the velocity of the fluid in m/s ');dD=input('Enter values of d/D in a vector ');Dp=(1-dD.^2).^2*ro*v^2/2;T=[dD; Dp];disp(' ')fprintf('Pressure drop for various values of d/D\n')fprintf('for fluid with density of % .0f kg/m^3 and velocity of %.1f m/s\n',ro,v)fprintf(' d/D Pressure drop (Pa)\n')fprintf(' %g %g\n',T)

Command Window:

Enter the velocity of the fluid in m/s 5Enter values of d/D in a vector [0.9:-0.1:0.3] Pressure drop for various values of d/Dfor fluid with density of 737 kg/m^3 and velocity of 5.0

m/s d/D Pressure drop (Pa) 0.9 332.571 0.8 1193.94 0.7 2396.17 0.6 3773.44 0.5 5182.03 0.4 6500.34 0.3 7628.87>>

Page 19: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 19

20. The net heat exchange by radiation from plate 1with radius b to plate 2 with radius a that areseparated by a distance c is given by:

Where and are the absolute temperatures

of the plates, W/(m2-K4) is theStefan-Boltzmann constant, and is ashape factor which, for the arrangement in thefigure, is given by:

Where , , and . Write a script file that cal-culates the heat exchange q. For input the program asks the user to entervalues for , , a, b, and c. For output the program prints a summary ofthe geometry and temperatures and then print the value of q. Use the scriptto calculate the results for K, K, m, m, and

, 1, and 10 m.

Solution

Script file:

clear, clc sigma=5.669e-8; T1=input('Please input the temperature of plate 1 in deg K: '); T2=input('Please input the temperature of plate 2 in deg K: '); a=input('Please input the radius of plate 1 in m: '); b=input('Please input the radius of plate 2 in m: '); c=input('Please input the distance between plate 1 and plate 2 in m: '); X=a./c; Y=c/b; Z=1+(1+X.^2).*Y.^2; F_1_2 = 0.5*(Z-sqrt(Z.^2-4*X.^2.*Y.^2)); q=sigma*pi*b^2*F_1_2*(T1^4-T2^4); fprintf('\nFor circular plate 1 with radius %i m and temperature %i',a,T1) fprintf(' deg K\nand circular plate 2 with radius %i m and temperature',b) fprintf(' %i deg K\n',T2) tbl=[c;q];

a

b

c

T1 T2

T1 T2

T1 400= T2 600= a 1= b 2=c 0.1=

Page 20: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

20 Chapter 4: Solved Problems

fprintf('\n Radiation\n') fprintf(' Separation Heat Exchange\n') fprintf(' (m) (Watts)\n') fprintf(' %4.1f %6.0f\n',tbl)

Command Window:

Please input the temperature of plate 1 in deg K: 400 Please input the temperature of plate 2 in deg K: 600 Please input the radius of plate 1 in m: 1 Please input the radius of plate 2 in m: 2 Please input the distance between plate 1 and plate 2 in m: 10.^(-1:1) For circular plate 1 with radius 1 m and temperature 400 deg K and circular plate 2 with radius 2 m and temperature 600 deg K Radiation Separation Heat Exchange (m) (Watts) 0.1 -18461 1.0 -14150 10.0 -706

Page 21: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 21

21. The equation of a circle in a plane with radius R and a center at point is given by:

The equation can also be written in the form:

where Given the coordinates of three points , , and it is

possible to determine the radius and the coordinates of the center of the cir-cle that passes through the three points. This is done by substituting thecoordinate of each of the points in the equation and solving the system ofthree linear equations for , , and c.Write a program in a script file that calculates the coordinates of the centerand the radius of a circle that passes through three given points. When exe-cuted the program asks the user to enter the coordinates of the three points.The program then calculates the center and radius and displays the resultsin the following format: “The coordinates of the center are (xx.x, xx.x) andthe radius is xx.x.”, where xx.x stands for the calculated quantities roundedto the nearest tenth. Execute the program entering the following threepoints: (11.5, 5), (3.2, 8.6), and (–4.5, –6.8).

Solution

Script File:A=input('Please enter the coordinates of the first point as a vector: ');B=input('Please enter the coordinates of the first point as a vector: ');C=input('Please enter the coordinates of the first point as a vector: ');a=[-2*A(1) -2*A(2) 1; -2*B(1) -2*B(2) 1; -2*C(1) -2*C(2) 1]b=[-(A(1)^2+A(2)^2); -(B(1)^2+B(2)^2); -(C(1)^2+C(2)^2)]x=a\bR=sqrt(x(1)^2+x(2)^2-x(3))

Command Window:

Please enter the coordinates of the first point as a vec-tor: [11.5 5]

Please enter the coordinates of the first point as a vec-tor: [3.2 8.6]

Please enter the coordinates of the first point as a vec-tor: [-4.5 -6.8]

Page 22: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

22 Chapter 4: Solved Problems

a = -23 -10 1 -6.4 -17.2 1 9 13.6 1b = -157.25 -84.2 -66.49x = 3.8213 -1.3356 -82.717R = 9.955

Answer: Center at [3.8213 -1.3356] Radius: 9.955.

22. A truss is a structure made of mem-bers joined at their ends. For the trussshown in the figure, the forces in the11 members are determined by solv-ing the following system of 11 equa-tions:

, ,

, ,

, ,

, ,

,

Write the equations in matrix form and use MATLAB to determine theforces in the members. A positive force means tensile force and a negativeforce means compressive force. Display the results in a table where the firstcolumn displays the member number and the second column displays thecorresponding force.

Solution

Script File:m=1:11;a=[cosd(50) 1 0 0 0 0 0 0 0 0 0sind(50) 0 0 0 0 0 0 0 0 0 0

800 lb

23

4

5

6

7

8

9

400 lb1200 lb

136 ft

48 ft42 ft30 ft

10

11

Page 23: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 23

0 -1 0 0 0 1 0 0 0 0 0-cosd(50) 0 0 1 cosd(41) 0 0 0 0 0 0-sind(50) 0 1 0 sind(41) 0 0 0 0 0 00 0 0 0 -cosd(41) -1 0 0 0 1 00 0 0 0 sind(41) 0 1 0 0 0 00 0 0 -1 0 0 0 1 cosd(37) 0 00 0 0 0 0 0 -1 0 -sind(37) 0 00 0 0 0 0 0 0 0 -cosd(37) -1 00 0 0 0 0 0 0 0 sind(37) 0 1];b=[0; 400; 0; 0; 800; 0; 1200; 0; 0; 4933; 0];x=a\b;tbl=[m' x];disp(' Member Force (lb)')disp(tbl)

Command Window:

Member Force (lb) 1 522.16 2 -335.64 3 2412.9 4 1730.9 5 -1848.8 6 -335.64 7 2412.9 8 4933 9 -4009.4 10 -1730.9 11 2412.9

Page 24: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

24 Chapter 4: Solved Problems

23. A truss is a structure made of mem-bers joined at their ends. For thetruss shown in the figure, the forcesin the 7 members are determined bysolving the following system of 7equations.

, ,

,

, Write the equations in matrix form and use MATLAB to determine theforces in the members. A positive force means tensile force and a negativeforce means compressive force. Display the results in a table where the firstcolumn displays the member number and the second column displays thecorresponding force.

Solution

Script File:m=1:7;a=[cosd(28.5) 1 0 0 0 0 0 sind(28.5) 0 0 0 0 0 0 -cosd(28.5) 0 -cosd(58.4) 0 cosd(58.4) cosd(28.5) 0-sind(28.5) 0 -sind(58.4) 0 -sind(58.4) -sind(28.5) 00 0 0 -1 -cosd(58.4) 0 10 0 0 0 0 sind(28.5) 00 0 0 0 0 -cosd(28.5) -1];b=[3000; -6521; -3000; 0; 0; -7479; 0];x=a\b;tbl=[m' x];disp(' Member Force (lb)')disp(tbl)

Command Window: Member Force (lb) 1 -13666 2 15010 3 9397.6 4 10086 5 7039.6 6 -15674 7 13775

3000 lb

2

3

4

56

7

6000 N8000 N

1

16 m16 m16 m

13 m

Page 25: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 25

24. The graph of the function passes through the points(–1.2, 18.8), (0.2, 5), (2, 16), and (3.5, 15). Determine the constants a, b, c, andd. (Write a system of four equations with four unknowns, and use MAT-LAB to solve the equations.)

Solution

Script File:

A=[(-1.2)^3 (-1.2)^2 -1.2 1 (0.2)^3 (0.2)^2 0.2 1 2^3 2^2 2 13.5^3 3.5^2 3.5 1];B=[18.8; 5; 16; 15];x=A\B;a=x(1)b=x(2)c=x(3)d=x(4)

Command Window:

a = -1.4987b = 6.4888c = -1.5099d = 5.0544

Page 26: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

26 Chapter 4: Solved Problems

25. The graph of the function passes through thepoints (–2.5, –62), (–1.5, –7.2), (–0.5, 8.3), (1, 3.7), and (3, 45.7). Determine theconstants a, b, c, d, and e. (Write a system of five equations with fourunknowns, and use MATLAB to solve the equations.)

Solution

Script File:A=[(-2.5)^4 (-2.5)^3 (-2.5)^2 -2.5 1 (-1.5)^4 (-1.5)^3 (-1.5)^2 -1.5 1 (-0.5)^4 (-0.5)^3 (-0.5)^2 -0.5 11^4 1^3 1^2 1 13^4 3^3 3^2 3 1];B=[-62; -7.2; 8.3; 3.7; 45.7];x=A\B;a=x(1)b=x(2)c=x(3)d=x(4)e=x(5)

Command Window:

a = -0.057085b = 3.2926c = -4.0056d = -3.4976e = 7.9677

Page 27: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 27

26. The surface of many airfoils can bedescribed with an equation of the form

where t is the maximum thickness as a fraction of the chord length c (e.g.,

). Given that m and m, the following values for yhave been measured for a particular airfoil:

Determine the constants , and . (Write a system of five equa-tions and five unknowns, and use MATLAB to solve the equations.)

Solution

Script file:

clear, clc

t=0.2; c=1;

K=t*c/0.2;

x=[0.15 0.35 0.5 0.7 0.85];

A=[sqrt(x(1)/c) x(1)/c (x(1)/c)^2 (x(1)/c)^3 (x(1)/c)^4

sqrt(x(2)/c) x(2)/c (x(2)/c)^2 (x(2)/c)^3 (x(2)/c)^4

sqrt(x(3)/c) x(3)/c (x(3)/c)^2 (x(3)/c)^3 (x(3)/c)^4

sqrt(x(4)/c) x(4)/c (x(4)/c)^2 (x(4)/c)^3 (x(4)/c)^4

sqrt(x(5)/c) x(5)/c (x(5)/c)^2 (x(5)/c)^3 (x(5)/

c)^4];

y=[0.08909; 0.09914; 0.08823; 0.06107; 0.03421]./K;

coefficients = A\y

Command Window:

coefficients = 0.29688 -0.12581 -0.35257 0.28606 -0.10251

x (m) 0.15 0.35 0.5 0.7 0.85

y (m) 0.08909 0.09914 0.08823 0.06107 0.03421

tmax ct= c 1= t 0.2=

a0 a1 a2 a3, , , a4

Page 28: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

28 Chapter 4: Solved Problems

27. During a golf match, a certain number of points are awarded for each eagleand a different number for each birdie. No points are awarded for par, anda certain number of points are deducted for each bogey and a differentnumber deducted for each double bogey (or worse). The newspaper reportof an important match neglected to mention what these point values were,but did provide the following table of the results:

From the information in the table write four equations in terms of fourunknowns. Solve the equations for the unknown points awarded for eaglesand birdies and points deducted for bogeys and double bogeys.

Solution

Script file:

clear, clcA=[1 2 1 12 3 0 11 4 1 01 3 2 0];B=[5; 12; 11; 8];Points=A\B

Command Window:

Points = 4.0000 2.0000 -1.0000 -2.0000>>

Golfer Eagles Birdies Pars Bogeys Doubles Points

A 1 2 10 1 1 5

B 2 3 11 0 1 12

C 1 4 10 1 0 11

D 1 3 10 2 0 8

Page 29: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 29

28. The dissolution of copper sulfide in aqueous nitric acid is described by thefollowing chemical equation:

where the coefficients a, b, c, d, e, f, and g are the numbers of the variousmolecule participating in the reaction and are unknown. The unknowncoefficients are determined by balancing each atom on left and right andthen balancing the ionic charge. The resulting equations are:

, , , , , There are seven unknowns and only six equations. A solution can still beobtained, however, by taking advantage of the fact that all the coefficientsmust be positive integers. Add a seventh equation by guessing andsolve the system of equations. The solution is valid if all the coefficients arepositive integers. If this is not the case, take and repeat the solution.Continue the process until all the coefficients in the solution are positiveintegers.

Solution

In matrix form, the system of equations is:

Script file:A=[1 0 0 -1 0 0 0

1 0 0 0 -1 0 0

0 1 0 0 0 -1 0

0 3 0 0 -4 -1 -1

0 0 1 0 0 0 -2

0 -1 1 -2 2 0 0

1 0 0 0 0 0 0]

B=[0; 0; 0; 0; 0; 0; 1] % guessing a=1

Solution1=A\B

B=[0; 0; 0; 0; 0; 0; 2] % guessing a=2

a d= a e= b f= 3b 4e f g+ += c 2g=

a 1=

a 2=

Page 30: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

30 Chapter 4: Solved Problems

Solution2=A\B

B=[0; 0; 0; 0; 0; 0; 3] % guessing a=3Solution3=A\B

Command Window:A = 1 0 0 -1 0 0 0 1 0 0 0 -1 0 0 0 1 0 0 0 -1 0 0 3 0 0 -4 -1 -1 0 0 1 0 0 0 -2 0 -1 1 -2 2 0 0 1 0 0 0 0 0 0B = 0 0 0 0 0 0 1Solution1 = 1.0000 2.6667 2.6667 1.0000 1.0000 2.6667 1.3333B = 0 0 0 0 0 0 2Solution2 = 2.0000 5.3333 5.3333 2.0000 2.0000 5.3333

Page 31: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 31

2.6667B = 0 0 0 0 0 0 3Solution3 = 3.0000 8.0000 8.0000 3.0000 3.0000 8.0000 4.0000

Answer: a = 3, b = 8, c = 8, d = 3, e = 3, f = 8, g = 4

Page 32: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

32 Chapter 4: Solved Problems

29. The Heat Index HI, Calculated from the air temperature and relativehumidity, is the apparent temperature felt by the body. An equation used bythe National Weather Service for calculating the HI is given by:

where T is the temperature in degrees F, and R is the relative humidity ininteger percentage. Write a MATLAB program in a script file that displaysthe following chart of Heat Index for given air temperature and relativehumidity in the Command Window:

Temperature (F)

80 82 84 86 88 90 92 94 Relative

Humidity

(%)

50 81 83 85 88 91 95 99 103

55 81 84 86 89 93 97 101 106

60 82 84 88 91 95 100 105 110

65 82 85 89 93 98 103 108 114

70 83 86 90 95 100 106 112 119

75 84 88 92 97 103 109 116 124

Solution

Script file:

clear, clcTs=80:2:94;T=[Ts;Ts;Ts;Ts;Ts;Ts];RH=[50:5:75]';R=[RH RH RH RH RH RH RH RH];A=-42.379; B=2.04901523;C=10.1433127;D=-0.22475541;E=-6.83783E-3;F=-5.481717E-2;G=1.22874E-3; H=8.5282E-4; I=-1.99E-6;HIT=round(A+B*T+C*R+D*T.*R+E*T.^2+F*R.^2+G*T.^2.*R+H*T.*R.^2+I*T.^2.*R.^2);disp(' Temperature (F)')fprintf(' ')fprintf(' %3.0f',Ts)fprintf('\n Relative\n Humidity\n (%%)\n')Table=[RH HIT]';

Page 33: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

Chapter 4: Solved Problems 33

%fprintf(' %3.0f\n',Table)%disp(Table)fprintf(' %6.0f %5.0f %6.0f %6.0f %6.0f %6.0f %6.0f

%6.0f %6.0f\n',Table)

30. The stress intensity factor K at a crack is given by

where σ is the far-field stress, a is the crack

length, and C is a parameter that depends on the geome-try of the specimen and crack. For the case of the edgecrack shown in the figure, C is given by:

Write a script file that will print out a table of values withthe ratio a/b in the first column and the correspondingparameter C in the second column. let a/b range between0.05 and 0.80 with increments of 0.05.

Solution

Script File:

ab=0.05:0.05:0.8;C=(1-ab/2+0.326*ab.^2)./sqrt(1-ab);tbl=[ab' C'];disp(' a/b C')disp(tbl)

Command Window:

a/b C 0.05 1.0012 0.1 1.0048 0.15 1.0113 0.2 1.0208 0.25 1.0339 0.3 1.051 0.35 1.0728 0.4 1.1001 0.45 1.134 0.5 1.1759

Page 34: Chapter 4 Solved Problems - HVL Hydrodynamikk...Chapter 4: Solved Problems 5 6. A 300 lb garage door is being opened by pulling on the cable as shown. As the door is lifted the force,

34 Chapter 4: Solved Problems

0.55 1.2278 0.6 1.2924 0.65 1.3738 0.7 1.4784 0.75 1.6168 0.8 1.8082