Problems

You can find the answers to problems marked with an asterisk at  he end of the text.

Section 2.1
1. a. Use two methods to create the vector x having 100 regularly  paced
values starting at 5 and ending at 28. b. Use two methods to create the vector x having a regular spacing of 0.2 starting at 2 and ending at 14. . c. Use two methods to create the vector x having 50 regularly spaced values starting at -2 and ending at 5.
2. a. Create the vector x having 50 logarithmically spaced values  tarting at
10 and ending at 1000. b. Create the vector x having 20 logarithmically spaced values starting at 10 and ending at 1000.
3.* Use MATLAB to’ create a vector x having six values between 0  nd 10
(including the endpoints 0 and 10). Create an array A whose first  ow
contains the values 3x and whose second row contains the values  x – 20.
4. ‘ Repeat Problem 3 but make the first column of A contain the  alues 3x and the second column contain the values 5x – 20.
5. Type this matrix in MATLAB and use MATLAB to answer the  ollowing questions: a. Create a vector v consisting of the elements in the second  olumn of A.

b. Create a vector w consisting of the elements in the second row of A.

6. Type this matrix in MATLAB and use MATLAB to answer the foIlowing questions: a. Create a 4 x 3 array B consisting of all elements in the second
through fourth columns of A.
b. Create a 3 x 4 array C consisting of all elements in the second
through fourth rows of A.
c. Create a 2 x 3 array D consisting of all elements in the first two rows
and the last three columns of A.

7. * Compute the length and absolute value of the following vectors:
a. x = [2, 4, 7]
b. y = [2, -4, 7]
c. z = [5+3i, -3 +4i, 2 – 7i]
8. Given the matrix a. Find the maximum and minimum values in each column.

b. Find the maximum and minimum values in each row.
9. Given the matrix a. Sort each column and store the result in an array B.
b. Sort each row and store the result in an array C.
c. Add each column and store the result .in an array D.
d. Add each row and store the result in an array E.
10. Consider the following arrays. Write MATLAB expressions to do the following.
a. Select just the second row of B.
b. Evaluate the sum of the second row of B.
c. Multiply the second column of B and the first column of A.
d. Evaluate the maximum value in the vector resulting from elementby-
by-element multiplication of the second column of B with the first
column of A.
e. Evaluate the sum of the first row of A divided element-by-element
by the first three elements of the third column of B.
Section 2.2
11 a. Create a three-dimensional array D whose three “layers” are these
matrices: b. Use MATLAB to find the largest element in each layer of D and the largest element in D.

Section 2.3

12. * Given the matrices Use MATLAB to:
a. Find A +B + C.
b. Find A – B + C.
c. Verify the associative law

(A+ B)+ C = A + (B+ C)

d. Verify the commutative law

A+B+C=B+C+A=A+C+B

13. * Given the matrices Use MATLAB to:
a. Find the result of A times B using the array product.
b. Find the result of A divided by B using array right division.
c. Find B raised to the third power element-by-element.
14.* The mechanical work W done in using a force F to push a block through a distance D is W = F D. The following table gives data on the amount of force used to push a block through the given distance over five segments of a certain path. The force varies because of the differing friction properties of the surface. Use MATLAB to find (a) the work done on each segment of the path and
(b) the total work done over the entire path.
15. Plane A is heading southwest at 200 mi/hr, while plane B is heading west
at ISO mi/hr, What is the velocity and the speed of plane A relative to
plane B?
16. The following table shows the hourly wages, hours worked, and output (number of widgets produced) in one week for five widget makers Use MATLAB to answer these questions:
a. How much did each worker earn in the week?
b. What is the total salary amount paid out?
c. How many widgets were made?
d. What is the average cost to produce one widget?
e. How many hours does it take to produce one widget on average?

f. Assuming that the output of each worker has the same quality, which worker is the most efficient? Which is the least efficient? .
17. Two divers start at the surface and establish the following coordinate system: x is to the west, y is to the north, and z is down. Diver 1 swims 60 ft east, then 25 ft south, and then dives 30 ft. At the same time, diver 2
dives 20 ft, swims east 30 ft, and then south 55 ft. a. Compute the distance between diver 1 and the starting point.
b. How far in each direction must diver 1 swim to reach diver 2?
c. How far in a straight line must diver 1 swim to reach diver 2?
18. The potential energy stored in a spring is k x 2/2, where k is the spring constant and x is the compression in the spring. The force required to compress the spring is kx. The following table gives the data for five springs Use MATLAB to find (0) the compression x in each spring and (b) the potential energy stored in each spring.
19. A company must purchase five kinds of material. The following table gives the price the company pays per ton for each material, along with the  number of tons purchased in the months of May, June, a~d July: Use MATLAB to answer these questions:
a. Create a 5 x 3 matrix containing the amounts spent on each item for
each month.
b. What is the total spent in May? in June? in July?
c. What is the total spent on each material in the three-month period?
d. What is the total spent on all materials in the three-month period?
20. A fenced enclosure consists of a rectangle of length L and width 2R, and a semicircle of radius R, as shown in Figure P20. The enclosure is to be built to have an area A of 1600 ft2• The cost of the fence is \$40/ft for
the curved portion, and \$30/ft for the straight sides. Use the min function to determine with a resolution of 0.0 I foot the values of Rand L required to minimize the total cost of the fence. Also compute the minimum cost 21. A geometric series is defined as the sequence 1, x, x2, x3, … , in which the powers of x range over the integers from 0 to 00. The sum of the terms in a geometric series converges to the limiting value of 1/(1 – x) if
[x] < 1; otherwise the terms diverge. a. For x =0.63, compute the sum of the first 11 terms in the series, and
compare the result with the limiting value. Repeat for 51 and 101 terms. Do this by generating a vector of integers to use as the exponent of x; then use the sum function.
b. Repeat part (Q) using x = -0.63. .
22. A water tank consists of a cylindrical part of radius r and height h, and a hemispherical top. The tank is to be constructed to hold 500 m3 of fluid when filled. The surface area of the cylindrical part is Zn rh, and its
volume is Jrr2h. The surface area of the hemispherical top is given by 2Jrr2, and its volume is given by 2Jrr3 /3. The cost to construct the cylindrical part of the tank is \$300/m2 of surface area; the hemispherical
part costs \$400/m2• Plot the cost versus r for 2 ::: r ::: 10m, and determine the radius that results in the least cost. Compute the corresponding height h.
23. Write a MATLAB assignment statement for each of the following functions, assuming that w, x, y, and z are vector quantities of equal 24. In many engineering systems an electrical power source supplies current or voltage to a device called the “load.” A common example is an amplifier-speaker system. The load is the speaker, which requires current
from the amplifier to produce sound. Figure P24a shows the general representation of a source and load. The resistance RL is that of the load. Figure P24b shows the circuit representation of the system. The source
supplies a voltage Vs and a current is and has its own internal resistance Rs. For optimum efficiency, we want to maximize the power supplied to the speaker for given values of Vs and Rs. We can do so by properly
selecting the value of the load resistance RL. The power consumed by the load is PL = i~RL = vU RL. Using the relation’ between VL and Vs we can express PL in terms•of vs as To maximize PL for a fixed value of vs, we must maximize the ratio Consider the specific case where the source resistance can be
Rs = 10, 15,20, or 25 Q and where the available load resistances are
RL = 10, 15,20,25, and 30Q. For a specific value of Rs, determine
which value of RL will maximize the power transfer.
25. .Some current research in biomedical engineering deals with devices for measuring the medication levels in the blood and automatically adjusting the intravenous delivery rate to achieve the proper concentration (too high
a concentration will cause adverse reactions). To design such devices, engineers must develop a model of the concentration as a function of the dosage and of time.
a. After a dose, the concentration declines due to metabolic processes. The half-life of a medication is-the time required after an initial dosage for the concentration to be’ teduced by one-half. A common
model for this process is where C(O) is the initial concentration, t is time (in hours), and k is called the elimination rate constant, which varies among individuals. For a particular bronchodilator, k has been estimated to be in the range 0.047 ~ k ~ 0.107 per hour. Find an expression for the half-life in terms of k, and obtain a plot of the half-life versus k for the
indicated range. b. If-the concentration is initially zero, and a constant delivery rate is started and maintained, the concentration as a function of time is described by: where a is a constant that depends on the delivery rate. Plot the concentration .after one hour, C(l), versus k for the case where a = I and k is in the range 0.047 ~ k ~ 0.107 per hour. ‘
26. A cable of length Lc supports a beam of length Li; so that it is horizontal when the weight W is attached at the beam end. The principles of statics can be used to show that the tension force T in the cable is given by where D is the distance of the cable attachment point to the beam pivot.
See Figure P26 a. Forthe case where W = 400 N, Lb = 3 m, and L; = 5 m, use element~by-eleme.nt. o~erations an~ the rrii n fun7tlon to compute ~e value of D that mimrmzes the tension T: (Do not use, a loop.) / ..-
Compute the minimum tension value., ‘ b. Check the sensitivity of the solution by plotting T versus D. How:’
much can D vary from its optimal valuebefore the terision T ” .increases 10 percent above its minimum value?

27. * Use MATLAB to find the products AB and BA for the following matrices: 28.’ Given the matrices Use MATLAB to:
a. Verify the associative, property

A(B + C) = AB +AC

b. Verify the distributive property

(AB)C = A(BC)

29. The following tables “show the costs associated with-a certain product and  the production volume for the four quarters of the business year MATLAB to find (a) the quarterly costs for materials, labor, and’

transportation; (b) the total material, labor, and transportation costs for the year; and (c) the total quarterly costs. 30.* Aluminum alloys are made by adding other elements to aluminum to improve its properties, such as hardness or tensile strength. The following table shows the composition of five commonly used alloys, which are
. known by their alloy numbers (2024, 6061, and so on) [Kutz, 1986]. Obtain a matrix algorithm to compute the amounts of raw materials needed to produce a given amount of each alloy. Use MATLAB to ,
determine how much raw material of each type is needed to produce 1000 tons of each alloy. 31. Redo Example 2.4-2 as a script file to allow the user to examine the effects of labor costs. Allow the user to input the four labor costs in the following table. When you run the file, it should display the quarterly costs
and the category costs. Run the file for the case where the unit labor costs are \$3000, \$7000, \$4000,· and \$8000, respectively. 32. Vectors with three elements can represent position, velocity, and acceleration. A mass of 5 kg, which is 3 m away from the x-axis, starts at x = 2 m and moves with a speed of 10 mls parallel to the y-axis. Its velocity is thus described by v = [0, 10,0], and its position is described by r = [2, lOt +3: 0]. Its angular momentum vector L is found from L = mer x v), where m is the mass. Use MATLAB to:
a. Compute a matrix P whose 11 rows are the values of the position vector r evaluated at the times t= 0,0.5, 1, 1.5, … 5 s.

b. What is the location of the mass when t = 5 s?
c. Compute the angular momentum vector L. What is its direction?

33.* The scalar triple product computes the magnitude M of the moment of a force vector F about a specified line. It is Nt = (r ~ F) . D, where r is the position vector from the line to the point of application of the force and D
is a unit vector in the direction of the line. Use MATLAB to compute the magnitude M for the case where
F = [10, -5,4] N, r = [- 3, 7,2] m, and D = [6,8, -7].

34.’ Verify the identity
A x (B x C) = B(A . C) – C(A . B)

for the vectors A = 5i – 3j +7k, B = -6i +4j + 3k, and C = 2i + 8j
-9k.

35. The area of a parallelogram can be computed from IA x BI, where A and B define two sides of the parallelogram (see Figure P35). Compute the area of a parallelogram defined by A = 7i and B = i + 3j . 36. The volume of a parallelepiped can be computed{;om IA· (B x Cj], where A, B, and C define three sides of the parallelepiped (see Figure P36). Compute the volume of a parallelepiped, defined by A = 6i, B = 2i +4j,
and C = 3i – 2k. Section 2.5
37. Use MATLAB to plot the polynomials y = 3×4 – 6×3 + 8×2 + 4x + 90 and z = 3×3 + 5×2 – 8x +70 over the interval -3 ::: x :::3. Properly label the plot and each curve. The variablesy and z represent current in
milliamps; the variable x represents voltage in volts.

38. Use MATLAB to plot the polynomial y = 3×4 – 5×3 – 28×2 – 5x + 200 on the interval -1 ::: x ::: 1. Put a grid on the plot and use the g inpu t function to determine the coordinates of the peak of the curve

39. Use MATLAB to find the following product:

(10×3 – 9×2 – 6x + 12)(5×3 _4x2 – 12x + 8)

40.* Use MATLAB to find the quotient and remainder of 41.* Use MATLAB to evaluate at x == 5.
42. Refer to Example 2.5-1. The polynomial equation that must be solved to find the natural frequencies of a particular building is
(a – /2)[(2a – /2)2 _ a2l+a2/2 _ 2a3

where a = k/4mrr2. Suppose m = 5000 kg. Consider three cases:
(1) k = 4 X 106 N/m; (2) k = 5 X 106 N/m; and (3) k = 6 X 106 N/m.
Write a MATLAB script file containing a for loop that does the algebra to answer these questions:
a. ‘Which case has the smallest natural frequency?
b. Which case has the largest natural frequency?
c. Which case has the smallest spread between the natural frequencies?
44.Engineers often need to estimate the pressures and volumes of a .gas in a
container. The idea/gas law provides one way of making theestimate,
The law is, More accurate estimates can be made with the van der Waals equation where the term b isa correction for the volume of the molecules, and the , term a/V2 is acorrection for molecular attractions. The values of a and b depend on the type of gas. The gas constant is R, the absolute temperature
is T, and the gas specific volume is V. If 1 mol of an ideal gas were confined to a volume of 22.41 L at ODC(273.2 K), it would exert a pressure of 1 atmosphere. In these units,R = 0.08206 .. For chlorine (Ch),a = 6.49 and b = 0.0562. Compare the specific volume estimates V given by the ideal gas law and the van der Waals
equation for 1 mol of Ch at 300 K and a pressure of 0.95 atmosphere .

45.Aircraft A is flying east at 320 mi/hr, while aircraft B is flying south at 160 mi/hr. At 1:00 P,M. the aircraft are located as shown in Figure P44.- a. ·Obtain the expression for thedistance D between the aircraft as a ,function of time. Plot D versus time until D reaches its minimum value.
b. Use the root s function to compute the time when the aircraft are first within 30 mi of each other

45. The function approaches 00 as>x …• 2 and as x ~I,’s’.’plbhhis function over the range . o ~ x ~ 7. Choose an appropriate range-for,the y-axis. ”
46. The following formulas are commonly!ftse” f. ‘ engineers to predict the lift and drag of an airfoil where L and D are the lift and drag forces, V isthe airspeed, S is the wing span, p is the air density, and CL and Co are the lift and drag coefficients. Both CLand Co depend on a, the angle of attack, the angle between the
relative air velocity and the airfoil’s chord line. . ‘ . Wind tunnel experiments for a particular airfoil have resulted in the following formulas (We will see in Chapter 5 how such formulas can be obtained from data)

CL = 4.47 x 1O-sa3 + 1.15 x 1O-3a2 +6.66 x 1O-2a + 1.02 x 10-1
Co = 5.75 x 1O-6a3 +5.09 x 1O-4a2 + 1.81 x 10-4a + 1.25 x 10-2
where a is in degrees

Plot the lift and drag ~f this airfoil versus V for 0 :::::V :::::150 mi/hr (you must convert V to ft/sec; there are 5280 ft/mi). Use the values p = 0.0 02378 slug/fr’ (air density at sea level), a = 10°, and S = 36 ft. The resulting values of L and D will be in pounds.

47. The lift-to-drag ratio is an indication of the effectiveness of an airfoil. Referring to Problem 46, the equations for lift and drag are where, for a particular airfoil, the lift and drag coefficients versus angle of attack a ‘are given by

CL =4.47 x 1O-5a3 + 1.15 x 1O-3a2 +6.66 x 1O-2a + 1.02 x 10-1
CD = 5.75 x 1O-6a3 + 5.09 x 1O-4a2 + 1.81 x 1O-4a + 1.25 x’1O-2 Using the first two equations, we see that the lift-to-drag ratio is given simply by the ratio CL/CD•

Plot L / D versus a for -2° ::::a: :::2::2°. Determine the angle of attack that maximizes L/ D.

Section 2.6
48. a. Use both cell indexing and content indexing to create the following 2 x 2 cell array b. What are the contents of the (1,1) element in the (2,1) cell in this array?
49. The capacitance of two parallel conductors of length L and radius ‘r ; separated by a distance d in air, is given by where E is the permittitivity of air (€ = 8.854 x 10-12 F/m). Create a cell array of capacitance values versus d, L, and r for d = 0.003, 0.004, 0.005

and 0.01 m; L = 1,2,3 m; and r =0.001, 0.002, 0.003 m. Use MATLAB to determine the capacitance value for d =0.005, L = 2, and r =V.OO1

Section 2.7
50. a. Create a structure array that contains the conversion factors for converting units of mass, force, and distance between the metric SI system and the British Engineering System.
b. Use your array to compute the following:
• The number of meters in 24 ft.
. • The number of feet in 65 m.
• The number of pounds equivalent to}8 N.
• The number of newtons equivalent to 5 lb.
• The number of kilograms in 6 slugs.
• The number of slugs in 15 kg.
51. Create a structure array that contains the following information fields concerning the road bridges in a town: bridge location, maximum load (tons), year built, year due for maintenance. Then enter the following data
into the array: 52. . Edit the structure array created in Problem 51 to change the maintenance data for the Clark St. bridge from 1998 to 2000.
53. Add the following bridge to the structure array created in Problem 51 