100% found this document useful (75 votes)
341 views34 pages

Applied Numerical Methods With MATLAB For Engineers and Scientists 2nd Edition Steven Chapra Solutions Manual 1

This document contains excerpts from Chapter 13 of the textbook "Applied Numerical Methods with MATLAB for Engineers and Scientists 2nd Edition" which discusses numerical methods for analyzing experimental data including calculating statistics like the mean, median, mode, standard deviation, and coefficient of variation. It shows examples of processing experimental data sets step-by-step and using MATLAB to calculate the same statistics for comparison. Tables of data are provided along with explanations of how to calculate various statistics either manually or with MATLAB functions. Histograms are also constructed from some of the example data sets.

Uploaded by

john
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (75 votes)
341 views34 pages

Applied Numerical Methods With MATLAB For Engineers and Scientists 2nd Edition Steven Chapra Solutions Manual 1

This document contains excerpts from Chapter 13 of the textbook "Applied Numerical Methods with MATLAB for Engineers and Scientists 2nd Edition" which discusses numerical methods for analyzing experimental data including calculating statistics like the mean, median, mode, standard deviation, and coefficient of variation. It shows examples of processing experimental data sets step-by-step and using MATLAB to calculate the same statistics for comparison. Tables of data are provided along with explanations of how to calculate various statistics either manually or with MATLAB functions. Histograms are also constructed from some of the example data sets.

Uploaded by

john
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

1

Applied Numerical Methods with MATLAB


for Engineers and Scientists 2nd Edition
Steven Chapra 007313290X
9780073132907
Download solution manual at:
https://testbankpack.com/p/solution-manual-for-applied-
numerical-methods-with-matlab-for-engineers-and-scientists-
2nd-edition-steven-chapra-007313290x-9780073132907/

CHAPTER 13
13.1 The data can be tabulated as

2
i y (yi – y )
1 8.8 0.725904
2 9.4 0.063504
3 10 0.121104
4 9.8 0.021904
5 10.1 0.200704
6 9.5 0.023104
7 10.1 0.200704
8 10.4 0.559504
9 9.5 0.023104
10 9.5 0.023104
11 9.8 0.021904
12 9.2 0.204304
13 7.9 3.069504
14 8.9 0.565504
15 9.6 0.002704
16 9.4 0.063504
17 11.3 2.715904
18 10.4 0.559504
19 8.8 0.725904
20 10.2 0.300304
21 10 0.121104
22 9.4 0.063504
23 9.8 0.021904
24 10.6 0.898704
25 8.9 0.565504
Σ 241.3 11.8624

(a)
PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
2
.3
y= = 9.652
241 25
(b) 9.6
(c) There are three values that occur most frequently: 9.4, 9.5 and 9.8.
(d) range = maximum – minimum = 11.3 – 7.9 = 3.4
11.8624
(e) s y = = 0.703041
25 − 1

(f) s 2y = 0.7030412 = 0.494267


0.703041
(g) c.v. = ×100% = 7.28%
9.652

Here is how the problem would be answered using MATLAB’s built-in functions:

>> y=[8.8 9.5 9.8 9.4 10 9.4 10.1 9.2 11.3 9.4 10 10.4 7.9 10.4 9.8 9.8
9.5 8.9 8.8 10.6 10.1 9.5 9.6 10.2 8.9];

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
3

>> m=mean(y)
m =
9.6520
>> median(y)
ans =
9.6000
>> mode(y)
ans =
9.4000
>> range=max(y)-min(y)
range =
3.4000
>> s=std(y)
s =
0.7030
>> var(y)
ans =
0.4943
>> cv=s/m
cv =
0.0728

13.2 The data can be sorted and then grouped. We assume that if a number falls on the border
between bins, it is placed in the lower bin.

lower upper Frequency


7.5 8 1
8 8.5 0
8.5 9 4
9 9.5 7
9.5 10 6
10 10.5 5
10.5 11 1
11 11.5 1

The histogram can then be constructed as

8
7
6
Frequency

5
4
3
2
1
0
7 8 9 10 11 12
Bin

13.3 The data can be tabulated as

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
4

2
I y (yi – y )
1 28.65 0.390625
2 28.65 0.390625
3 27.65 0.140625
4 29.25 1.500625
5 26.55 2.175625
6 29.65 2.640625
7 28.45 0.180625
8 27.65 0.140625
9 26.65 1.890625
10 27.85 0.030625
11 28.65 0.390625
12 28.65 0.390625
13 27.65 0.140625
14 27.05 0.950625
15 28.45 0.180625
16 27.65 0.140625
17 27.35 0.455625
18 28.25 0.050625
19 31.65 13.14063
20 28.55 0.275625
21 28.35 0.105625
22 28.85 0.680625
23 26.35 2.805625
24 27.65 0.140625
25 26.85 1.380625
26 26.75 1.625625
27 27.75 0.075625
28 27.25 0.600625
Σ 784.7 33.0125

784.7
(a) y = = 28.025
28

(b) 27.8
(c) 27.65
(d) range = maximum – minimum = 31.65 – 27.65 = 5.3
33.0125
(e) s y = = 1.105751
28 − 1

(f) s 2y = 1.1057512 = 1.222685

1.105751
(g) c.v. = ×100% = 3.95%
28.025

Here is how the problem would be answered using MATLAB’s built-in functions:
PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
5

>> y=[28.65 28.65 27.65 29.25 26.55 29.65 28.45 27.65 26.65 27.85 28.65
28.65 27.65 27.05 28.45 27.65 27.35 28.25 31.65 28.55 28.35 28.85 26.35
27.65 26.85 26.75 27.75 27.25];
>> m=mean(y)
m =
28.0250
>> median(y)
ans =
27.8000
>> mode(y)
ans =
27.6500
>> range=max(y)-min(y)
range =
5.3000
>> s=std(y)
s =
1.1058
>> var(y)
ans =
1.2227
>> cv=s/m
cv =
0.0395

(h) The data can be sorted and grouped.

Lower Upper Frequency


26 26.5 1
26.5 27 4
27 27.5 3
27.5 28 7
28 28.5 4
28.5 29 6
29 29.5 1
29.5 30 1
30 30.5 0
30.5 31 0
31 31.5 0
31.5 32 1

The histogram can then be constructed as

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
6

8
7
6
Frequency

5
4
3
2
1
0
26 27 28 29 30 31 32
Bin
(i) 68% of the readings should fall between y − s y and y + s y . That is, between 28.025 –

1.10575096 = 26.919249 and 28.025 + 1.10575096 = 29.130751. Twenty values fall between
these bounds which is equal to 20/28 = 71.4% of the values which is not that far from 68%.

13.4 The sum of the squares of the residuals for this case can be written as

n
Sr = ∑ (y
i=1
i − a1 x i )
2

The partial derivative of this function with respect to the single parameter a1 can be determined as
∂S r
= −2 [( y i − a1 x i )x i ]

∂a1

Setting the derivative equal to zero and evaluating the summations gives
0= ∑
y x −a x2 ∑
i i 1 i

which can be solved for

a1 =
∑y x i i

∑x 2
i

So the slope that minimizes the sum of the squares of the residuals for a straight line with a zero
intercept is merely the ratio of the sum of the dependent variables (y) times the sum of the
independent variables (x) over the sum of the independent variables squared (x2).

The following M-file determines the best-fit slope and plots the resulting line,

function [a] = linregrzero(x,y)


% linregrzero: linear regression curve fitting with zero intercept
% [a, r2] = linregr(x,y): Least squares fit of straight
% line to data with zero intercept
% input:

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
7

% x = independent variable
% y = dependent variable
% output:
% a = slope

n = length(x);
if length(y)~=n, error('x and y must be same length'); end
x = x(:); y = y(:); % convert to column vectors
sx2 = sum(x.*x); sxy = sum(x.*y);
a = sxy/sx2;
% create plot of data and best fit line
xp = linspace(0,max(x),2);
yp = a*xp;
plot(x,y,'o',xp,yp)
grid on

>> x=[2 4 6 7 10 11 14 17 20];


>> y=[4 5 6 5 8 7 6 9 12];
>> a1=linregrzero(x,y)

a1 =
0.6053

13.5 The results can be summarized as

y versus x x versus y
Best fit equation y = 4.851535 + 0.35247x x = −9.96763 + 2.374101y
Standard error 1.06501 2.764026
Correlation coefficient 0.914767 0.914767

We can also plot both lines on the same graph

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
8

y 12

8
y
4 y versus x
x versus y x
0
0 5 10 15 20

Thus, the “best” fit lines and the standard errors differ. This makes sense because different errors
are being minimized depending on our choice of the dependent (ordinate) and independent
(abscissa) variables. In contrast, the correlation coefficients are identical since the same amount
of uncertainty is explained regardless of how the points are plotted.

13.6 Linear regression with a zero intercept gives [note that T(K) = T(oC) + 273.15].

15000

10000

y = 29.728x
5000 2
R = 0.9999

0
0 100 200 300 400 500

Thus, the fit is

p = 29.728T

Using the ideal gas law

⎛ p⎞V
R=⎜ ⎟
⎝T ⎠ n

For our fit

p
= 29.728
T

For nitrogen,

1 kg
n=
28 g/mole

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
9

Therefore,

⎛ 10 ⎞
R = 29.728⎜ 3 ⎟ = 8.324
⎝ 10 / 28 ⎠

This is close to the standard value of 8.314 J/gmole.

13.7 The function can be linearized by dividing it by x and taking the natural logarithm to yield

ln( y / x) = ln α 4 + β 4 x

Therefore, if the model holds, a plot of ln(y/x) versus x should yield a straight line with an
intercept of lnα4 and a slope of β4.

x y ln(y/x)
0.1 0.75 2.014903
0.2 1.25 1.832581
0.4 1.45 1.287854
0.6 1.25 0.733969
0.9 0.85 -0.05716
1.3 0.55 -0.8602
1.5 0.35 -1.45529
1.7 0.28 -1.80359
1.8 0.18 -2.30259

3 y = -2.4733x + 2.2682
2
2 R = 0.9974
1
0
-1
-2
-3
0 0.5 1 1.5 2

Therefore, β4 = −2.4733 and α4 = e2.2682 = 9.661786, and the fit is

y = 9.661786xe −2.4733x

This equation can be plotted together with the data:

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
10

0
0 0.5 1 1.5 2

13.8 The data can be transformed, plotted and fit with a straight line

v, m/s F, N ln v ln F
10 25 2.302585 3.218876
20 70 2.995732 4.248495
30 380 3.401197 5.940171
40 550 3.688879 6.309918
50 610 3.912023 6.413459
60 1220 4.094345 7.106606
70 830 4.248495 6.721426
80 1450 4.382027 7.279319

8 y = 1.9842x - 1.2941
2
7 R = 0.9481
6
5
4
3
2
2 2.5 3 3.5 4 4.5

The least-squares fit is

ln y = 1.9842ln x −1.2941

The exponent is 1.9842 and the leading coefficient is e−1.2941 = 0.274137. Therefore, the result is
the same as when we used common or base-10 logarithms:

y = 0.274137x 1.9842

13.9 (a) The data can be plotted

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
11

2000
1600
1200
800
400
0
0 10 20 30

The plot indicates that the data is somewhat curvilinear. An exponential model (i.e., a semi-log
plot) is the best choice to linearize the data. This conclusion is based on

• A power model does not result in a linear plot


• Bacterial decay is known to follow an exponential model
• The exponential model by definition will not produce negative values.

The exponential fit can be determined as

t (hrs) c (CFU/100 mL) ln c


4 1590 7.371489
8 1320 7.185387
12 1000 6.907755
16 900 6.802395
20 650 6.476972
24 560 6.327937

y = -0.0532x +
7.6
7.5902
7.2 2
R = 0.9887
6.8
6.4
6

0 10 20 30

Therefore, the coefficient of the exponent (β1) is −0.0532 and the lead coefficient (α1) is e7.5902 =
1978.63, and the fit is

c = 1978.63e −0.0532t

Consequently the concentration at t = 0 is 1978.63 CFU/100 ml. Here is a plot of the fit along
with the original data:

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
12

2400
2000
1600
1200
800
400
0
0 10 20 30

(b) The time at which the concentration will reach 200 CFU/100 mL can be computed as

200 = 1978.63e −0.0532t

⎛ 200 ⎞
ln⎜ ⎟ = −0.0532t
⎝ 1978.63 ⎠

⎛ 200 ⎞
ln⎜ ⎟
⎝ 1978.63 ⎠
t= = 43.08 d
− 0.0532

13.10 (a) The exponential fit can be determined with the base-10 logarithm as

t (hrs) c (CFU/100 mL) log c


4 1590 3.201397
8 1320 3.120574
12 1000 3
16 900 2.954243
20 650 2.812913
24 560 2.748188

3.3 y = -0.0231x + 3.2964


2
3.2 R = 0.9887
3.1
3
2.9
2.8
2.7
0 10 20 30

Therefore, the coefficient of the exponent (β5) is −0.0231 and the lead coefficient (α5) is 103.2964 =
1978.63, and the fit is

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
13

c = 1978.63(10) −0.0231t

Consequently the concentration at t = 0 is 1978.63 CFU/100 ml.

(b) The time at which the concentration will reach 200 CFU/100 mL can be computed as

200 = 1978.63(10) −0.0231t


200
log10 ⎜ ⎟ = −0.0231t
⎛ ⎞
⎝ 1978.63 ⎠
200
log ⎜ ⎟
⎛ ⎞
t= ⎝ 1978.63 ⎠ = 43.08 d
10

− 0.0231

Thus, the results are identical to those obtained with the base-e model.

The relationship between β1 and β5 can be developed as in

e − β1t = 10 − β 5t

Take the natural log of this equation to yield

− β 1t = − β 5 t ln10

or

β 1 = 2.302585 β 5

13.11 The power fit can be determined as


2
W (kg) A (m ) log W log A
70 2.1 1.845098 0.322219
75 2.12 1.875061 0.326336
77 2.15 1.886491 0.332438
80 2.2 1.90309 0.342423
82 2.22 1.913814 0.346353
84 2.23 1.924279 0.348305
87 2.26 1.939519 0.354108
90 2.3 1.954243 0.361728

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
14

0.37
logA = 0.3799logW - 0.3821
0.36 2
R = 0.9711
0.35

0.34

0.33

0.32
0.31
1.8 1.84 1.88 1.92 1.96

Therefore, the power is b = 0.3799 and the lead coefficient is a = 10−0.3821 = 0.4149, and the fit is

A = 0.4149W 0.3799

Here is a plot of the fit along with the original data:

2.35
2.3
2.25
2.2
2.15
2.1
2.05
70 75 80 85 90

The value of the surface area for a 95-kg person can be estimated as

A = 0.4149(95) 0.3799 = 2.34 m 2

13.12 A power fit can be determined by taking the common logarithm of the data,

Mass Metabolism
Animal (kg) (watts) log(Mass) log(Met)
Cow 400 270 2.6021 2.4314
Human 70 82 1.8451 1.9138
Sheep 45 50 1.6532 1.6990
Hen 2 4.8 0.3010 0.6812
Rat 0.3 1.45 -0.5229 0.1614
Dove 0.16 0.97 -0.7959 -0.0132

Linear regression gives

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
15

3 y = 0.7266x + 0.5301
2
R = 0.9982
2

0
-1 0 1 2 3
-1

Therefore, the power is b = 0.7266 and the lead coefficient is a = 100.5301 = 3.389, and the fit is

Metabolism = 3.389Mass 0.7266

Here is a plot of the fit along with the original data:


300
250
200
150
0.7266
y = 3.3893x
100 2
R = 0.9982
50
0
0 100 200 300 400

13.13 We regress ln(y) versus x to give

ln y = 6.303701 + 0.818651x

Therefore, α1 = e6.303701 = 546.5909 and β1 = 0.818651, and the exponential model is

y = 546.5909e 0.818651x

The model and the data can be plotted as

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
16

0.8187x
4000 y = 546.59e
2
R = 0.9933

3000

2000

1000

0
0 0.5 1 1.5 2 2.5

A semi-log plot can be developed by plotting the natural log versus x. As expected, both the data
and the best-fit line are linear when plotted in this way.

8.5
8
7.5
7
6.5
6
0 0.5 1 1.5 2 2.5

13.14 The equation can be linearized by inverting it to yield

1 c 1 1
= s +
k k max c 2 k max

Consequently, a plot of 1/k versus 1/c should yield a straight line with an intercept of 1/kmax and a
slope of cs/kmax

2 2 2 2
c, mg/L k, /d 1/c 1/k 1/c ×1/k (1/c )
0.5 1.1 4.000000 0.909091 3.636364 16.000000
0.8 2.4 1.562500 0.416667 0.651042 2.441406
1.5 5.3 0.444444 0.188679 0.083857 0.197531
2.5 7.6 0.160000 0.131579 0.021053 0.025600
4 8.9 0.062500 0.112360 0.007022 0.003906
Sum → 6.229444 1.758375 4.399338 18.66844

The slope and the intercept can be computed as


5(4.399338) −6.229444(1.758375)
a1 = = 0.202489
5(18.66844) − (6.229444) 2

1.758375 6.229444
a0 = − 0.202489 = 0.099396
5 5

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
17

Therefore, kmax = 1/0.099396 = 10.06074 and cs = 10.06074(0.202489) = 2.037189, and the fit is

10.06074c 2
k=
2.037189 + c 2

This equation can be plotted together with the data:

10
8
6
4
2
0
0 1 2 3 4 5

The equation can be used to compute

10.06074(2) 2
k= = 6.666
2.037189 + (2) 2

13.15
function stats(x)
% stats: simple descriptive statistics and histogram
% stats(x): computes simple descriptive statistics
% and generates a histogram for the values
% in a vector
% input:
% x = vector of values
% output:
% the function does not return any values, but displays the
% following statistics: number of values, mean, median, mode,
% range, standard deviation, variance,
% and coefficient of variation
if length(x)<=1, error('Vector must hold at least 2 values'); end
fprintf('number = %5d\n', length(x))
fprintf('mean = %8.4g\n', mean(x))
fprintf('median = %8.4g\n', median(x))
fprintf('mode = %8.4g\n', mode(x))
fprintf('range = %8.4g\n', max(x)-min(x))
fprintf('standard deviation = %8.4g\n', std(x))
fprintf('variance = %8.4g\n', var(x))
fprintf('coefficient of variation = %8.4g\n', std(x)/mean(x))
hist(x)

Application to Prob. 13.3:

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
18

>> y=[28.65 28.65 27.65 29.25 26.55 29.65 28.45 27.65 26.65 27.85 28.65
28.65 27.65 27.05 28.45 27.65 27.35 28.25 31.65 28.55 28.35 28.85 26.35
27.65 26.85 26.75 27.75 27.25];
>> stats(y)

number = 28
mean = 28.02
median = 27.8
mode = 27.65
range = 5.3
standard deviation = 1.106
variance = 1.223
coefficient of variation = 0.03946

13.16
function [a, r2, syx] = linregr2(x,y)
% [a, r2, syx] = linregr(x,y):
% Least squares fit of a straight line to data
% by solving the normal equations.
% input:
% x = independent variable
% y = dependent variable
% output:
% a = vector of slope, a(1), and intercept, a(2)
% r2 = coefficient of determination
% syx = standard error of the estimate

n = length(x);
if length(y)~=n, error('x and y must be same length'); end
x = x(:); y = y(:); % convert to column vectors
sx = sum(x); sy = sum(y);
sx2 = sum(x.*x); sxy = sum(x.*y); sy2 = sum(y.*y);
a(1) = (n*sxy-sx*sy)/(n*sx2-sx^2);
a(2) = sy/n-a(1)*sx/n;

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
19

syx=sqrt(sum((y-a(1)*x-a(2)).^2)/(n-2));
r2 = ((n*sxy-sx*sy)/sqrt(n*sx2-sx^2)/sqrt(n*sy2-sy^2))^2;
% create plot of data and best fit line
xp = linspace(min(x),max(x),2);
yp = a(1)*xp+a(2);
res=a(1)*x+a(2)-y;
subplot(2,1,1);plot(x,y,'o',xp,yp)
xlabel('x'),ylabel('y'),title('Linear Least-Squares Fit')
subplot(2,1,2);plot(x,res,'o',x,res)
xlabel('x'),ylabel('residual'),title('Residual Plot')
grid on

Test application to data from Examples 13.2 and 13.3,

>> x=[10 20 30 40 50 60 70 80];


>> y=[25 70 380 550 610 1220 830 1450];
>> [a, r2, syx] = linregr2(x,y)

a =
19.4702 -234.2857

r2 =
0.8805

syx =
189.7885

13.17
function [b, r2] = powerfit(x,y)
% linregr: linear regression curve fitting
% [b, r2] = powerfit(x,y): Least squares fit of straight
% line to log-transformed data
% input:
% x = independent variable
% y = dependent variable
% output:
% b = vector of coefficient, b(1), and exponent, b(2)
% r2 = coefficient of determination

n = length(x);
if length(y)~=n, error('x and y must be same length'); end
x = x(:); y = y(:);
xl=log10(x);yl=log10(y);
sx = sum(xl); sy = sum(yl);
sx2 = sum(xl.*xl); sxy = sum(xl.*yl); sy2 = sum(yl.*yl);
% compute slope and intercept
a(1) = (n*sxy-sx*sy)/(n*sx2-sx^2);
a(2) = sy/n-a(1)*sx/n;
% compute coefficient and exponent
b(1) = 10^a(2);
b(2) = a(1);
St=sum((mean(y)-y).^2)
ypred = b(1)*x.^b(2);
Sr=sum((ypred-y).^2)
r2 = (St - Sr)/St;

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
20

% create plots of data and best fit line


xp = linspace(min(x),max(x));
yp = b(1)*xp.^b(2);
subplot(2,1,1);plot(x,y,'o',xp,yp)
plot(x,y,'o',xp,yp)
xlabel('x'),ylabel('y'),title('Fit (untransformed)')
subplot(2,1,2);loglog(x,y,'o',xp,yp)
xlabel('log(x)'),ylabel('log(y)'),title('Fit (transformed)')
grid on

Application to Prob. 13.12.

>> mass=[400 70 45 2 0.3 0.16];


>> metabolism=[270 82 50 4.8 1.45 0.97];
>> [b,r2]=powerfit(mass,metabolism)

b =
3.3893 0.7266
r2 =
0.9978

13.18 A log-log plot of μ versus T suggests a linear relationship.

10
1
0.1 10 100 1000

0.01
0.001
0.0001

We regress log10μ versus log10T to give


log 10 μ = 4.581471 − 3.01338 log10 T (r 2 = 0.975703)

Therefore, α2 = 104.581471 = 38,147.94 and β2 = –3.01338, and the power model is

μ = 38,147.94T −3.01338

The model and the data can be plotted on untransformed scales as

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
21

2.5
-3.0134
y = 38148x
2
2
1.5 R = 0.9757

1
0.5
0
0 50 100 150 200 250 300 350

13.19 We can first try a linear fit

1800 y = 2.5826x + 1365.9


2
R = 0.9608
1600
1400
1200

-60 -30 0 30 60 90 120

As shown, the fit line is somewhat lacking. Therefore, we can use polynomial regression to fit a
parabola
2
1800 y = 0.0128x + 1.8164x + 1331
2
1600 R = 0.9934

1400
1200

-60 -30 0 30 60 90 120

This fit seems adequate in that it captures the general trend of the data. Note that a slightly better
fit can be attained with a cubic polynomial, but the improvement is marginal.

13.20 (a) The linear fit is

80
y = 1.05897x + 0.81793
2
60 R = 0.90583

40

20

0
0 20 40 60 80

The tensile strength at t = 32 can be computed as

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
22

y = 1.05897(32) + 0.81793 = 34.7048913

(b) A straight line with zero intercept can be fit as

y = 1.07514x
80 R2 = 0.90556
60

40

20

0
0 20 40 60 80

For this case, the tensile strength at t = 32 can be computed as

y = 1.07514(32) = 34.40452

13.21 The equation can be linearized,


⎛ −dA / dt ⎞ E1
ln⎜ ⎟ = ln k 01 −
⎝ A ⎠ RT

This indicates that a plot of ln(–(dA/dt)/A) versus 1/T should have an intercept of ln k01 and a
slope of E1/R.

>> dAdt=[460 960 2485 1600 1245];


>> A=[200 150 50 20 10];
>> T=[280 320 450 500 550];
>> y=log(dAdt./A);
>> TI=1./T;
>> [a,r2]=linregr(TI,y)

a =
1.0e+003 *
-2.2683 0.0089
r2 =
0.9999

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
23

>> k01=exp(a(2))

k01 =
7.6205e+003
>> E1=-a(1)*0.00198
E1 =
4.4913

Therefore, k01 = 7,620.5 and E1 = 4.4913.

13.22 The standard errors can be computed via Eq. 17.9

S
sy/ x = r
n− p

n = 15

Model A Model B Model C


Sr 135 105 100
Number of model parameters fit (p) 2 3 5
sy/x 3.222517 2.95804 3.162278

Thus, Model B seems best because its standard error is lower.

13.23 A plot of the natural log of cells versus time indicates two straight lines with a sharp break
at 2. Each range can be fit separately with the exponential model as shown in the second plot.

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
24

2
1
0
-1 0 2 4 6
-2
-3

6
1.1999x
4 y = 0.1000e
2
R = 1.0000 y = 0.4951e
0.4001x

2 2
R = 1.0000

0
0 2 4 6 8

13.24 (a) and (b) Simple linear regression can be applied to yield the following fit

4
y = 0.7335x + 0.7167
3 2
R = 0.8374
2
1
0
0 0.5 1 1.5 2 2.5 3 3.5

(c) The minimum lane width corresponding to a bike-car distance of 2 m can be computed as

y = 0.7335(2) + 0.7167 = 2.1837 m

13.25 (a) and (b) Simple linear regression can be applied to yield the following fit

24 y = 0.1519x + 0.8428
R2 = 0.894
20

16

12
80 90 100 110 120 130 140 150

(c) The flow corresponding to the precipitation of 120 cm can be computed as

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
25

Q = 0.1519(120) + 0.8428 =19.067

(d) We can redo the regression, but with a zero intercept

24 y = 0.1594x
R2 = 0.8917
20

16

12
80 90 100 110 120 130 140 150

Thus, the model is

Q = 0.1594P

where Q = flow and P = precipitation. Now, if there are no water losses, the maximum flow, Qm,
that could occur for a level of precipitation should be equal to the product of the annual
precipitation and the drainage area. This is expressed by the following equation.
⎛ cm ⎞
Qm = A(km 2 )P⎜ ⎟
yr
⎝ ⎠

For an area of 1100 km2 and applying conversions so that the flow has units of m3/s

⎛ cm ⎞ 10 6 m 2 1 m d yr
1,100 km 2
Qm = P⎜ ⎟ 2
yr km 100 cm 86,400 s 365 d
⎝ ⎠

Collecting terms gives

Qm = 0.348808P

Using the slope from the linear regression with zero intercept, we can compute the fraction of the
total flow that is lost to evaporation and other consumptive uses can be computed as

0.348808 −0.1594
F= = 0.543
0.348808

13.26 First, we can determine the stress

25000
σ= = 2,347.418
10.65

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
26

We can then try to fit the data to obtain a mathematical relationship between strain and stress.
First, we can try linear regression:

0.01 y = 1.37124E-06x - 2.28849E-03


2
0.008 R = 0.856845
0.006
0.004
0.002
0
-0.002 0 2000 4000 6000 8000

This is not a particularly good fit as the r2 is relatively low. We therefore try a best-fit parabola,
2
0.01 y = 2.8177E-10x - 8.4598E-07x + 1.0766E-03
2
0.008 R = 0.98053
0.006
0.004
0.002
0
0 2000 4000 6000 8000

We can use this model to compute the strain as

ε = 2.8177 ×10 −10 (2347.4178) 2 − 8.4598 ×10 −7 (2347.4178) + 1.0766 ×10 −3 = 6.4341×10 −4

The deflection can be computed as

ΔL = 6.4341×10 −4 (9) = 0.0057907 m

13.27 (a) The linear fit is

30 y = 2.8082x - 0.5922
2
R = 0.9991
20

10

0
0 2 4 6 8 10 12

The current for a voltage of 3.5 V can be computed as

y = 2.8082(3.5) − 0.5922 = 9.2364

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
27

Both the graph and the r2 indicate that the fit is good.

(b) A straight line with zero intercept can be fit as

30 y = 2.7177x
R2 = 0.9978
20

10

0
0 2 4 6 8 10 12

For this case, the current at V = 3.5 can be computed as

y = 2.7177(3.5) = 9.512

13.28 Linear regression yields

20 y = 0.0195x + 3.2895
2
15 R = 0.9768

10
5

0
0 100 200 300 400 500 600 700

The percent elongation for a temperature of 400 can be computed as

% elongation = 0.0195(400) + 3.2895 = 11.072

13.29 The fit of the exponential model is


2500 0.151x
y = 97.915e
2000 2
R = 0.9996
1500
1000
500
0
0 5 10 15 20

The model can be used to predict the population 5 years in the future as

p = 97.91484e 0.150992(25) = 4268

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
28

13.30 We fit a number of curves to this data and obtained the best fit with a second-order
polynomial with zero intercept

5 2
y = 1628.1x + 140.05x
4 2
R =1
3
2
1
0
0 0.004 0.008 0.012 0.016 0.02 0.024

Therefore, the best-fit curve is

u = 1628.1y 2 + 140.05 y

We can differentiate this function

du
= 3256.2 y + 140.05
dy

Therefore, the derivative at the surface is 140.05 and the shear stress can be computed as 1.8×10–
5
(140.05) = 0.002521 N/m2.

13.31 We can use transformations to linearize the model as

1
ln μ = ln D + B
Ta

Thus, we can plot the natural log of μ versus 1/Ta and use linear regression to determine the
parameters. Here is the data showing the transformations.

T μ Ta 1/Ta ln μ
0 1.787 273.15 0.003661 0.580538
5 1.519 278.15 0.003595 0.418052
10 1.307 283.15 0.003532 0.267734
20 1.002 293.15 0.003411 0.001998
30 0.7975 303.15 0.003299 -0.22627
40 0.6529 313.15 0.003193 -0.42633

Here is the fit:

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
29

0.8
y = 2150.8x - 7.3143
0.6 2
0.4 R = 0.998
0.2
0
-0.2
-0.4
-0.6

0.0031 0.0032 0.0033 0.0034 0.0035 0.0036 0.0037

Thus, the parameters are estimated as D = e–7.3143 = 6.65941×10–4 and B = 2150.8, and the
Andrade equation is

μ = 6.65941×10 −4 e 2150.8 / Ta

This equation can be plotted along with the data

1.5

0.5

0
0 10 20 30 40

Note that this model can also be fit with nonlinear regression. If this is done, the result is

μ = 5.39872 ×10 −4 e 2210.66 / Ta

Although it is difficult to discern graphically, this fit is slightly superior (r2 = 0.99816) to that
obtained with the transformed model (r2 = 0.99757).

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
30

13.5
2
I xi yi xi xiyi
1 0 9.8100 0 0
2 20000 9.7487 4.0E+08 194974
3 40000 9.6879 1.6E+09 387516
4 60000 9.6278 3.6E+09 577668
5 80000 9.5682 6.4E+09 765456
Σ 200000 48.4426 1.2E+10 1925614

5(1,925,614) −200,000(48.4426)
a = =− × −6
1 3.0225 10
5(1.2 ×1010 ) − 200,000 2

48.4426 200,000
a0 = − 3.0225 ×10 −6 = 9.80942
5 5

Therefore, the line of best fit is (using the nomenclature of the problem)

g = 9.80942 − 3.0225 ×10 −6 y

The value at 55,000 m can therefore be computed as

g = 9.80942 − 3.0225×10 −6 (55,000) = 9.6431825


13.6 Regression gives

p = 8100.47 + 30.3164T (r2 = 0.999)

12000
10000
8000

6000
4000
2000
0
-50 0 50 100 150

⎛ p⎞V
R=⎜ ⎟
⎝T ⎠ n

p
= 30.3164
T

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
31

1 kg
n=
28 g/mole

⎛ 10 ⎞
R = 30.3164⎜ 3 ⎟ = 8.487
⎝ 10 / 28 ⎠

This is close to the standard value of 8.314 J/gmole.

13.7 Linear regression gives


0.6 y = 0.0454x + 0.1077
2
R = 0.999
0.4

0.2

0
0 2 4 6 8 10

Forcing a zero intercept yields


0.6 y = 0.061x
2
R = 0.8387
0.4

0.2

0
0 2 4 6 8 10

One alternative that would force a zero intercept is a power fit


0.6 0.4069
y = 0.1827x
2
R = 0.9024
0.4

0.2

0
0 2 4 6 8 10

However, this seems to represent a poor compromise since it misses the linear trend in the data.
An alternative approach would to assume that the physically-unrealistic non-zero intercept is an

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
32

artifact of the measurement method. Therefore, if the linear slope is valid, we might try y =
0.0454x.

13.14 Linear regression of the log transformed data yields


logε& = −5.41log B + 2.6363log σ (r2 = 0.9997)

0.7 0.8 0.9 1 1.1 1.2


-2.4

-2.8

-3.2

-3.6

Therefore,

B = 10 -5.41 = 3.88975 × 10 -6

m = 2.6363

and the untransformed model is

ε& = 3.88975 ×10 -6 σ 2.6363

A plot of the data and the model can be developed as

0.005
0.004
0.003
0.002
0.001
0
0 5 10 15

13.15 Linear regression of the data yields


τ = 2.779 + 0.685γ& (r2 = 0.977121)

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
33

8
6
4
2
0
0 2 4 6

Therefore, μ = 0.685 and τy = 2.779 N/m2.

13.16 The data can be transformed

strain stress log(strain) log(stress)


50 5.99 1.69897 0.777427
70 7.45 1.845098 0.872156
90 8.56 1.954243 0.932474
110 9.09 2.041393 0.958564
130 10.25 2.113943 1.010724

Linear regression of the transformed data yields

log τ = −0.13808 + 0.54298log γ& (r2 = 0.989118)

1.1
1
0.9
0.8
0.7
0.6
1.6 1.8 2 2.2

Therefore, μ = 10–0.54298 = 0.72765 and n = 0.54298. The power model is therefore,

τ = 0.72765γ& 0.54298

A plot of the power model along with the data can be created as

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
34

12

0
0 50 100 150

PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.

You might also like