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',BMI)
Command Window:
Please enter your weight in pounds: 162
Please enter your height in inches: 68
The BMI is 24.6
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 a
MATLAB program in a script file that calculates the h for a given p. For
input the program asks the user to enter the pressure in units of millibars.
The program then calculates the altitude rounded to the nearest integer. For
output the program displays the message: “The altitude is: XX ft.” where
XX is the calculated value of h. Determine the altitude if the pressure is 394
mb.
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.',h)
Command Window:
Please enter the enter the pressure in units of
millibars: 394
The altitude is 23915 ft.
3. Write a MATLAB program that determines the radius,
r, of the largest sphere that can be inscribed inside a
cone with base radius R and height h. For input the
program asks the user to enter values for R and h. The
program then calculates r rounded to the nearest tenth.
For output the program displays the message: “The
radius of the largest sphere that can be inscribed inside
a cone with a base radius of XX in. and heights of XX
in. is: XX in.” where XX are the corresponding numerical values. Use the
program 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
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')
fprintf('with a base radius of %5.1f in. and heights of
%5.1f in. is: %5.1f in.',R,h,r)
Command Window:
Please enter the radius of the cone: 8
Please enter the heigh of the cone: 22
The radius of the largest sphere that can be inscribed inside
a cone
with 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, A
0
is the amount at time , and k is a
constant. 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), and
the number of years t from now for which amount should be calculated.
From this information the program first calculates the constant k and then
the amount at t years. For output the program displays the message: “The
amount 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',t,A)
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 of
fuel in gallons as a function of h. Create a vector
for h ranging from 0 to 14 in. with increments of
2 in. Then calculate the corresponding volume
rounded to the nearest tenth of a gallon. Display
the results in a two-column table where in the
first column are the values of h and in the second column the associated val-
ues of volume (in gallons).
Solution
Script 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) ')
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
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,
F, in the cable, as a func-
tion of the angle θ, is given by:
where
Calculate F for θ=0° through 90° with
increments 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) ')
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
6 Chapter 4: Solved Problems
7. Write a MATLAB program in a script file that calculate the average and the
standard deviation of a list of grades as well as the number of grades on the
list. The program asks the user (input command) to enter the grades as
elements of a vector. The program then calculates the required quantities
using MATLAB’s built-in functions length, mean, and std. The results
are 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 the
nearest tenth.
“The standard deviation is XX.” where XX is the numerical value rounded
to 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.
Solution
Script 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('There are %i grades.',number)
fprintf('The average grade is %.1f.',aver)
fprintf('The standard deviation is %.1f.',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.
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, A
0 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, and
then 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 (the
time 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 is
compounded. 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 of
times per year that the interest is compounded. The output is displayed in
the following format: “The value of a $XX investment at a yearly interest
rate of X.X% compounded X times per year, after XX years is
$XXXX.XX”, where XXX stands for the corresponding quantities. Use the
program to determine the value of a $20,000 investment after 18 years if the
yearly interest rate is 3.5% compounded 6 time a year.
Solution
Script File:
P=input('Please enter the amount of the initial
investment($): ');
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%%',P,r)
fprintf('compounded %.0f times per year after %.0f years
is $%.2f',n,t,V)
Command Window:
Please enter the amount of the initial investment($):
20000
Please enter the number of years: 18
Please enter the interest rate (%): 3.5
Please 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 three
houses shown are connected to a pole as
shown. Write a MATLAB program that deter-
mines the location of the pole (distance x) that
minimizes the total length of the cables
needed. In the program define a vector x with
values ranging from 50 to 200 with increments
of 0.1. Use this vector to calculate the corre-
sponding values of total length of the cables. Then use MATLAB’s built-in
function min to find the value of x that corresponds to the shortest length
of cables.
Solution
Script File:
x=50:0.1:200;
x
210 ft
80 ft
80 ft
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.56
n =
1139.00
xOfLmin =
163.80
11. Early explorers often estimated altitude by measuring the temperature of
boiling 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, the
first altitude and the second boiling temperature. The altitude should range
between
–500 ft and 10,000 ft at increments of 500 ft.
Solution
Script File:
format short g
alt=-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
T
b
49.161pln 44.932+=
T
b
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 a
triangular printed area of 600 in.
2
(shaded area
with a base length of
a and height of h in the fig-
ure). As shown in the figure, there is a 2-in. gap
between the sides of the triangles. Write a MAT-
LAB program that determine the dimensions
a
and h such that the overall area of the sign will
be as small as possible. In the program define a
vector
a with values ranging from 10 to 120 with
increments of 0.1. Use this vector for calculating
the corresponding values of
h and the overall area of the sign. Then use
MATLAB’s built-in function min to find the dimensions of the smallest
sign.
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.
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.1299
i =
273
amin =
37.2000
hmin =
32.2581
13. The angle θ at which a viewer sees
the picture on the screen in a
movie theater depends on the dis-
tance x from the screen. Write a
MATLAB program that deter-
mines the angle θ (in degrees) for
viewers setting at distances of 20, 26, 32, 38, 44, 50, 56 62 and 68 ft. Display
the results in a two-column table.
Solution
Script 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
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 pieces
which are welded together to form a pyramid
as shown, such that in the rectangular base
. Write a MATLAB program that
determines the dimensions
a and b such that
the volume of the pyramid will be as large as
possible. In the program define a vector
a with
values 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 the
volume. Then use MATLAB’s built-in function max to find the dimensions
of 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+03
i =
734
a
b
h
Chapter 4: Solved Problems 13
amax =
11.3300
bmax =
21.5270
15. A person at point A spots a child in
trouble at point B across the river. The
person can run at a speed of 8.6 ft/s and
can swim at a speed of 3.9 ft/s. In order
to reach the child in the shortest time the
person runs to point C and then swims
to point B, as shown. Write a MATLAB program that determines the
distance 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 with
increments of 1. Use this vector to calculate the corresponding values of
x.Then use MATLAB’s built-in function min to find the value of x that
corresponds 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+03
i =
1527
xmin =
1526
A
B
C
10,000 ft
x
3,000 ft
14 Chapter 4: Solved Problems
16. The maximum stress σ
max at the edge
of a hole (diameter d) in a thin plate,
with width w and thickness t, loaded
by a tensile force F as shown is given
by:
where and .
Write a program in a script file that calculates σ
max
. The program should
read 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 and
numbers,— i.e., something like: “The maximum stress in a plate with a
width 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.txt
F=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. ',w)
fprintf('and thickness of %.4f in. and a hole of %.3f in.
in diameter, ',t,d)
fprintf('due to a tensile force of %.1f lb is %.1f
psi.',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
FF
d
w
t
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 constant
speed of mi/h along a straight path as
shown. The airplane is being tracked by a
radar station positioned a distance ft
below 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 a
three-column table where the first column is
t, the second is the angle θ in
degrees, and the third is the corresponding value of
r.
Solution
Script File:
format shortg
v=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
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. For
Germanium, 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 xls
spreadsheet using the xlsread command. The output should be presented
as a table where the first column is the temperature and the second column
is 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',tbl')
Excel file:
E
g
C13.83= E
g
0.67=
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 in
diameter is given by:
where ρ is the density of the fluid,
v, the velocity of the flow, and d and D are
defined 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/m
3
, the velocity in m/s, and values of the non-dimensional
ratio as a vector. The program displays the inputted values of ρ and
v
followed 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/m
3
) at
m/s and the following ratios of diameters
.
Dd
v
ρ737=
v5=
18 Chapter 4: Solved Problems
Solution
Script file:
clear,clc
ro=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')
fprintf('for fluid with density of % .0f kg/m^3 and
velocity of %.1f m/s',ro,v)
fprintf(' d/D Pressure drop (Pa)')
fprintf(' %g %g',T)
Command Window:
Enter the velocity of the fluid in m/s 5
Enter values of d/D in a vector [0.9:-0.1:0.3]
Pressure drop for various values of d/D
for 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
>>
Chapter 4: Solved Problems 19
20. The net heat exchange by radiation from plate 1
with radius b to plate 2 with radius a that are
separated by a distance c is given by:
Where and are the absolute temperatures
of the plates, W/(m
2
-K
4
) is the
Stefan-Boltzmann constant, and is a
shape factor which, for the arrangement in the
figure, is given by:
Where , , and . Write a script file that cal-
culates the heat exchange
q. For input the program asks the user to enter
values for , ,
a, b, and c. For output the program prints a summary of
the geometry and temperatures and then print the value of
q. Use the script
to 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('For circular plate 1 with radius %i m and
temperature %i',a,T1)
fprintf(' deg Kand circular plate 2 with radius %i m
and temperature',b)
fprintf(' %i deg K',T2)
tbl=[c;q];
a
b
c
T
1
T
2
T
1
T
2
T
1
400= T
2
600= a1= b2=
c0.1=
20 Chapter 4: Solved Problems
fprintf(' Radiation')
fprintf(' Separation Heat Exchange')
fprintf(' (m) (Watts)')
fprintf(' %4.1f %6.0f',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
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 the
coordinate of each of the points in the equation and solving the system of
three linear equations for , , and c.
Write a program in a script file that calculates the coordinates of the center
and 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 results
in the following format: “The coordinates of the center are (xx.x, xx.x) and
the radius is xx.x.”, where xx.x stands for the calculated quantities rounded
to the nearest tenth. Execute the program entering the following three
points: (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
R=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]
22 Chapter 4: Solved Problems
a =
-23 -10 1
-6.4 -17.2 1
9 13.6 1
b =
-157.25
-84.2
-66.49
x =
3.8213
-1.3356
-82.717
R =
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 truss
shown in the figure, the forces in the
11 members are determined by solv-
ing the following system of 11 equa-
tions:
,
,
, ,
, ,
, ,
,
Write the equations in matrix form and use MATLAB to determine the
forces in the members. A positive force means tensile force and a negative
force means compressive force. Display the results in a table where the first
column displays the member number and the second column displays the
corresponding force.
Solution
Script File:
m=1:11;
a=[cosd(50) 1 0 0 0 0 0 0 0 0 0
sind(50) 0 0 0 0 0 0 0 0 0 0
800 lb
2
3
4
5
6
7
8
9
400 lb1200 lb
1
36 ft
48 ft42 ft30 ft
10
11
24 Chapter 4: Solved Problems
23. A truss is a structure made of mem-
bers joined at their ends. For the
truss shown in the figure, the forces
in the 7 members are determined by
solving the following system of 7
equations.
,
,
,
,
Write the equations in matrix form and use MATLAB to determine the
forces in the members. A positive force means tensile force and a negative
force means compressive force. Display the results in a table where the first
column displays the member number and the second column displays the
corresponding 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) 0
0 0 0 -1 -cosd(58.4) 0 1
0 0 0 0 0 sind(28.5) 0
0 0 0 0 0 -cosd(28.5) -1];
b=[3000; -6521; -3000; 0; 0; -7479; 0];
x=a;
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
5
6
7
6000 N
8000 N
1
16 m16 m16 m
13 m
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, and
d. (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 1
3.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.4987
b =
6.4888
c =
-1.5099
d =
5.0544
26 Chapter 4: Solved Problems
25. The graph of the function passes through the
points
(–2.5, –62), (–1.5, –7.2), (–0.5, 8.3), (1, 3.7), and (3, 45.7). Determine the
constants
a, b, c, d, and e. (Write a system of five equations with four
unknowns, 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 1
1^4 1^3 1^2 1 1
3^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.057085
b =
3.2926
c =
-4.0056
d =
-3.4976
e =
7.9677
Chapter 4: Solved Problems 27
26. The surface of many airfoils can be
described 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
y
have 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
t
max
ct= c1= t0.2=
a
0
a
1
a
2
a
3
,,, a
4
28 Chapter 4: Solved Problems
27. During a golf match, a certain number of points are awarded for each eagle
and a different number for each birdie. No points are awarded for par, and
a certain number of points are deducted for each bogey and a different
number deducted for each double bogey (or worse). The newspaper report
of 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 four
unknowns. Solve the equations for the unknown points awarded for eagles
and birdies and points deducted for bogeys and double bogeys.
Solution
Script file:
clear, clc
A=[1 2 1 1
2 3 0 1
1 4 1 0
1 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
A1 2101 1 5
B2 3110 112
C1 4101 011
D1 3102 0 8
Chapter 4: Solved Problems 29
28. The dissolution of copper sulfide in aqueous nitric acid is described by the
following chemical equation:
where the coefficients
a, b, c, d, e, f, and g are the numbers of the various
molecule participating in the reaction and are unknown. The unknown
coefficients are determined by balancing each atom on left and right and
then balancing the ionic charge. The resulting equations are:
, , , , ,
There are seven unknowns and only six equations. A solution can still be
obtained, however, by taking advantage of the fact that all the coefficients
must be positive integers. Add a seventh equation by guessing and
solve the system of equations. The solution is valid if all the coefficients are
positive integers. If this is not the case, take and repeat the solution.
Continue the process until all the coefficients in the solution are positive
integers.
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
ad= ae= bf= 3b4efg++= c2g=
a1=
a2=
Chapter 4: Solved Problems 31
2.6667
B =
0
0
0
0
0
0
3
Solution3 =
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
32 Chapter 4: Solved Problems
29. The Heat Index HI, Calculated from the air temperature and relative
humidity, is the apparent temperature felt by the body. An equation used by
the National Weather Service for calculating the HI is given by:
where
T is the temperature in degrees F, and R is the relative humidity in
integer percentage. Write a MATLAB program in a script file that displays
the following chart of Heat Index for given air temperature and relative
humidity 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, clc
Ts=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(' Relative Humidity (%%)')
Table=[RH HIT]';
Chapter 4: Solved Problems 33
%fprintf(' %3.0f',Table)
%disp(Table)
fprintf(' %6.0f %5.0f %6.0f %6.0f %6.0f %6.0f %6.0f
%6.0f %6.0f',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 edge
crack shown in the figure,
C is given by:
Write a script file that will print out a table of values with
the ratio a/b in the first column and the corresponding
parameter
C in the second column. let a/b range between
0.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