Download ebooks file Applied Numerical Methods with MATLAB for Engineers and Scientists 2nd ed Edition Steven C. Chapra all chapters
Download ebooks file Applied Numerical Methods with MATLAB for Engineers and Scientists 2nd ed Edition Steven C. Chapra all chapters
com
https://ebookfinal.com/download/applied-numerical-methods-
with-matlab-for-engineers-and-scientists-2nd-ed-edition-
steven-c-chapra/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookfinal.com/download/essential-matlab-for-engineers-and-
scientists-fourth-edition-brian-hahn/
ebookfinal.com
https://ebookfinal.com/download/physics-for-scientists-engineers-with-
modern-physics-douglas-c-giancoli/
ebookfinal.com
https://ebookfinal.com/download/essential-c-for-engineers-and-
scientists-2nd-edition-jeri-r-hanly/
ebookfinal.com
https://ebookfinal.com/download/numerical-methods-using-matlab-gupta/
ebookfinal.com
Mathematical Methods for Mathematicians Physical
Scientists and Engineers 2nd Edition Jeremy Dunning-Davies
https://ebookfinal.com/download/mathematical-methods-for-
mathematicians-physical-scientists-and-engineers-2nd-edition-jeremy-
dunning-davies/
ebookfinal.com
https://ebookfinal.com/download/dictionary-of-applied-math-for-
engineers-and-scientists-1st-edition-emma-previato/
ebookfinal.com
https://ebookfinal.com/download/c-for-engineers-and-scientists-3rd-
edition-gary-j-bronson/
ebookfinal.com
https://ebookfinal.com/download/patent-fundamentals-for-scientists-
and-engineers-3rd-ed-edition-gordon/
ebookfinal.com
https://ebookfinal.com/download/numerical-methods-third-edition-using-
matlab-george-lindfield/
ebookfinal.com
CONTENTS
About the Aufhor iv
Prefoce xiii
PanrOur Modeling,Computers,
ond ErrorAnolysis I
l. I Motivofion I
1.2 Port Orgonizotion 2
CHAPTER
I
Mothemqticol Modeling, Numericol Methods,
ond Problem Solving 4
I . l A S i m p l eM o t h e m o t i c M
o lo d e l 5
1.2 Conservotion Lowsin Engineering ond Science 12
1.3 NumericolMethodsCoveredin ThisBook l3
P r o b l e m s1 7
CHAPTER2
MATLAB Fundomeniqls 20
2.1 TheMATIABEnvironmenl21
2.2 A s s i g n m e n t2 2
2.3 Mothemoticol Operotions 27
2.4 U s eo f B u i l t l nF u n c t i o n s3 0
2.5 Groohics 33
2.6 OtherResources36
2.7 CoseStudy:Explorotory DotoAnolysis 37
^ l l
rroblems JY
CHAPTER3
Progromming with MATTAB 42
3.1 M-Files43
3.2 InputOutput47
vl CONTENTS
3 . 3 S h u c t u r ePdr o g r o m m i n g5 l
3 . 4 N e s t i n go n d I n d e n t o t i o n6 3
3 . 5 P o s s i nF g u n c t i o nt os M - F i l e s 6 6
3.6 CoseStudy:BungeeJumperVelocity 71
Problems 75
4
CHAPTER
Roundoff qnd Truncotion Errors 79
4.1 ErrorsB0
4.2 RoundoffErrors 84
4.3 Truncotion Errors 92
,l03
4 . 4 T o t oNl u m e r i c oEl r r o r
4 . 5 B l u n d e r sM, o d e lE r r o r so, n d D o t oU n c e r t o i n t y1 0 8
,l09
Problems
.|11
PnnrTwo Roots
ondOptimizotion
2.1 Overview tll
2.2 Port Orgonizotion I 12
CHAPTER
5
Roois: Brocketing Methods I l4
5 . 1 R o o t si n E n g i n e e r i nogn d S c i e n c e I l 5
5 . 2 G r o p h i c oM l ethods I l6
5 . 3 B r o c k e t i nMg e t h o d so n d I n i t i oG
l u e s s e s1 1 7
5 . 4 B i s e c t i o n1 2 2
5 . 5 F o l s eP o s i t i o n 1 2 8
5.6 CoseStudv:Greenhouse Gosesond Roinwoter 132
,l35
Problems
CHAPTER
6
Roots: Open Methods | 39
6 . 1 S i m p l eF i x e d - P o ilnt ei r o t i o n 1 4 0
6 . 2 N e w t o n - R o p h s o1n4 4
6 . 3 S e c o nM t ethods 149
6.4 MATLAB F u n c t i o nf :z e r o r 5 1
6 . 5 P o l v n o m l o l s1 5 4
6 . 6 C o s eS t u d yP : i p eF r i c t i o n 1 5 7
Problems 162
CONTENTS Yrt
7
CHAPTER
Optimizofion 166
7.1 Introduciion ond Bockground 167
7 . 2 O n e - D i m e n s i o n o l O p t i m i z o t i1o7n0
7 . 3 M u l t i d i m e n s i o n o l O p t i m i z o t i1o7n9
7 . 4 C o s eS t u d yE : q u i l i b r i uomn d M i n i m u mP o t e n t i oEln e r g y l 8 l
P r o b l e m s1 8 3
,|89
PrnrTxnrr LineorSystems
3.1 Overview 189
3.2 Port Orgonizotion l9l
CHAPTER
8
Lineqr Algebroic Equofions ond Motrices | 93
8.1 MotrixAlgebroOverview 194
with MATLAB 203
8.2 SolvingLineorAlgebroicEquotions
8.3 CoseStudy:Currentsond Voltogesin Circuits 205
Problems 209
9
CHAPTER
Gouss Eliminotion 212
l u m b e r so f E q u o t i osn 2 1 3
9 . 1 S o l v i n gS m o l N
9 . 2 N o i v eG o u s sE l i m i n o t i o n2 1 8
9.3 Pivoting225
9 . 4 T r i d i o g o n oSly s t e m s2 2 7
9.5 CoseStudy:Model of o HeotedRod 229
Problems 233
IO
CHAPTER
[U Foctorizotion 236
l 0 . l O v e r v i e wo f l U F o c t o r i z o t i o n2 3 7
1 0 . 2 G o u s sE l i m i n o t i oons l U F o c t o r i z o t i o n2 3 8
1 0 . 3 C h o l e s kFy o c t o r i z o t i o n2 4 4
'l0.4
MATLABLeftDivision 246
Problems 247
vIt! CONIENTS
CHAPTERI I
Motrix lnverse ond Condition 249
1 i .l TheMotrix lnverse 249
I I .2 ErrorAnolysisond SystemCondition 253
I 1 . 3 C o s eS t u d yI:n d o o rA i r P o l l u t i o n2 5 8
Problems 261
CHAPTER
I2
Iterotive Methods 264
l2.l LineorSystems: Gouss-Seidel264
,l2.2
r y s t e m s2 7 0
N o n l i n e oS
1 2 . 3 C o s eS t u d vC : h e m i c oRl e o c t i o n s2 7 7
P r o b l e m s2 7 9
CHAPTER
I3
Lineor Regression 284
1 3 . I S t o t i s t i cRse v i e w 2 8 6
1 3 . 2 L i n e o Lr e o s t - S q u oR r eesg r e s s i o n2 9 2
,l3.3
L i n e o r i z o t i o nf N o n l i n e oR
r e l o t i o n s h i p3s0 0
1 3 . 4 C o m p u t eAr p p l i c o t i o n s3 0 4
1 3 . 5 C o s eS i u d y E : n z y m eK i n e t i c s 3 0 7
^ l l
rroDtems 5 | z
CHAPTER
I4
Generol lineqr Leosf-Squores qnd Nonlineqr Regression 316
1 4 .I P o l y n o m i o Rle g r e s s i o n3 16
1 4 . 2 M u l t i p l eL i n e oR r e g r e s s i o n3 2 O
1 4 . 3 G e n e r oLl i n e oLr e o sSt o u o r e s 3 2 2
14.4 QR Foctorizotion ond the Bockslosh Ooerotor 325
1 4 . 5 N o n l i n e oR r e g r e s s i o n
3 2 6
1 4 . 6 C o s eS l u d y F : i t t i n gS i n u s o i d s3 2 8
h l l
rrontcms . 1 . 1/
CONIENIS
'I
5.'l lntroduction
to Interpotofion336
I5.2 NewronInterpoloring polynomiol
33g
j: .j tosron9etnrerpoloring polynomiol
347
rJ.4 tnversetnterpolotion
350
I J.J txkopolotion o n d O s c i l l o t i o n s3 5 1
Problems 355
t6
cHAPTER
Splines ond piecewise Inferpofofion
359
I 6 . I l n k o d u c t i otno S p l i n e s
359
l o . z L i n e aSr p l i n e s3 6 1
1 6 . 3 Q u o d r o i i cS p l i n e s
365
1 6 . 4 C u b i cS p l i n e s 3 6 8
l9: liTewiseInrerpotorion
i 6.6 Multidimensionol
inMATLAB 374
Interpolotion 37g
l6 Z CoseStudy:HeotTronsfer
3g2
rrobtems 386
PnnrFvr Infegrotion
ond Differentiotion3g9
5.1 Overview 3g9
5.2 Port Orgonizotion
39O
!H,\PTER| 7
Numericof fnfegrofion Formutos
'l Sg2
Z.J lnhoduction ond Bocrground 393
I7.2 Newton-Cotes Formutos 396
17.3 TheTropezoidol Rule 39g
1 7 . 4 S i m p s o n ,Rsu l e s 4 0 5
17.5 Higher-Order Newfon_Cotes Formulos 4j j
l7 6 lntegration with UnequolSegments 412
17.7 OpenMerhods 416
I 7 8 M u h , p l eI n t e g r o l s
4j 6
CompuringWork wirh Numericol
;lJ;:r";udy: lnregrorion 4j9
t
I
!
t
I
1 8 . 3 G o u s sQ u o d r o t u r e4 3 2
I 8 . 4 A d o p t i v eQ u o d r o t u r e4 3 9
I8.5 CoseStudy:Root-Meon-Squore Current 440
Problems 444
CHAPTER
I9
Numericql Differentiqtion 448
19.I Inhoduction ond Bockground 449
19.2 High-Accurocy Differentiotion Formulos 452
I9.3 R i c h o r d s oEnx t r o p o l o t i o n4 5 5
,l9.4
Derivotives of UnequollySpocedDoto 457
,l9.5
Derivotivesond lntegrolsfor Dofo with Errors 458
19.6 PortiolDerivotives 459
I9.2 NumericolDifferentiotion with MATLAB 460
I 9 . 8 C o s eS t u d yV : i s u o l i z i nFgi e l d s 4 6 5
Problems 467
Pnnr5x OrdinoryDifferentiol
Equotions473
6.1 Overview 473
6.2 Porl Orgonizofion 477
CHAPTER
20
Initiol-Volue Problems 479
20.I Overview 481
20.2 EuleisMethod 481
20.3 lmprovemenlsof Euler'sMethod 487
20.4 Runge-KutfoMethods 493
20.5 Systemsof Equotions 498
20.6 CoseStudy:Predotory-PreyModelsond Choos 50A
Problems 509
CHAPTER
2I
Adopfive Merhods ond Stiff Systems 514
21 .'l AdoptiveRunge-Kutto Methods 514
2l .2 MultistepMethods 521
2l .3 Stiffness525
2l .4 MATLAB A p p l i c o t i o nB: u n g e Je u m p ew
r i t hC o r d 5 3 1
2l .5 CoseStudy:Pliny'slntermittent Fountoin 532
r r o D l e m s3 J /
CONTENTS xl
22
CHAPTER
Boundory-Volue Problems 540
22.1 lntrodvction ond Bockground 541
22.2 lhe ShootingMethod 545
22.3 Finite-Difference Methods 552
P r o b l e m s5 5 9
APPENDIXA: EIGENVALUES
565
APPENDIXB: MATLABBUILT-INFUNCTIONS 576
APPENDIX€: MATIAB M-FltE FUNCTIONS 578
BIBLIOGRAPHY579
rNDEX 580
Modqling,CoTpute''i,
qnd Erior Anolysis
t.t MoTtvATtoN
What are numericalmethodsand why shouldyou stridythem?
Numericalmethodsare techniquesby which mathematicalproblemsare formulatedso
that they can be solved with arithmeticand logical operations.Becausedigital computers
excel at perform.ingsuchoperations.numericalmethodsare sometimesreferredto as com-
puter mathematics.
In the pre-computerera, the time and drudgeryof implementingsuchcalculationsse.--
riously limited their practical use. However, with the advent of fast, inexpensivedigttul
computers,the role of numerical methodsin engineeringand scientific problem solving
has exploded.Becausethey figure so prominently in,:'
much of our work, I believe that numerical methods
should be a part of every engineer'sand scientist's
basic education.Just as we a.ll must have solid foun-
dationsin the other areasof mathematicsand science,
we should also have a fundamentalunderstandingof
numerical methods.In particular,we should have a
solid appreciationof both their capabilitiesand their
limitations.
Beyond contributing to your overall education.
.thog T9 several additibnat reasons why you shoutO
study numerical methods: .",,,,rr,,,r,,,r,,,,,,
how numerical
With thesereasonslls motivation.we can now set out to understand
methodsand digital computerswork in tandemto generatereliablesolutionsto mathemat-
ical problems.The remainderof this book is devotedto this task.
1.2 PARTORGANIZATION
This book is divided into six parts.The latter five partsfocus on the major areasof numer-
ical methods.Although it might be temptingto jump right into this material,Part One con-
sistsof four chaptersdealng with essentialbackgroundmaterial.
Chapter 1 providesa concreteexampleof how a numericalmethodcan be employed
to solve a real problem. To do this, we develop tt muthematicalmodel of a fiee-falling
bungeejumper. The model, which is basedon Newton's secondlaw, resultsin an ordinary
differentialequation.After first using calculusto developa closed-formsolution,we then
show how a comparablesolution can be generatedwith a simple numerical method.We
end the chapterwith an overview of the major areers of numericalrnethodsthat we cover in
PartsTwo throughSir.
Chapters2 and 3 provide an introduction to the MATLAB' software environment.
Chapter2 dealswith the standardway of operatingMATLAB by enteringcommandsone
at a time in the so-calledt'alculatornuttle.Thisinteractivemodeprovidesa straightforward
meansto orient you kl the enviroumentand illustrateshow it is usedibr common opera-
I.2 PART
ORGANIZATION
Chapter-l shows how MATLAB's programming mode providesa vehicle for assem-
bling individualcommandsinto algorithms.Thus,our intentis to illustratehow MATLAB
servesas a convenientprogrammingenvironmentto developyour own software.
ChapterI dealswith the irnportanttopic of error analysis,which must be understood
for the effective use of numerical methods.The first part of the chapterfocuseson the
roundoJferrors thar result becausedigital computerscannot representsome quantities
truncationerrctrsthat arisefiom using an approximation
exactly.The latter part addresses
in place of an exactmathematicalprocedure.
{.1:i
TFi + I r,if i
..,,lrfi;
U1
I
MothemoticolModeling,
NumericolMethods,
ond ProblemSolving
4
CHAPTER
OBJECTIVES
r
The prirnary objectiveof this chapteris to provide you with a concreteidea of what
numericalmethodsare and how they relateto engineeringanclscientificproblem 1
solving. Specificobjectivesand topicscoveredare
o Learning how mathematicalmodelscan be formulatedon the basisof scientific FIG
principlesto simulatethe behaviorof a simplephysicalsystem. For
f-^^ l
I cc-
r Understandinghow numericalmethodsirlford a meansto generatesolutionsin a
rnannerthat can be irnplementedon a digital computer.
ium
o Understandingthe different typesof conservationlaws that lie beneaththe models
usedin the variousengineeringdisciplinesand appreciatingthe diff'erence
betweensteady-state irnd dynamic solutionsof thesemodels.
r Learning aboutthe difterent typesof numericalmethodswe will cover in this
book.
Upwardforce of fluid mechanics,you developthe following mathematicalmodel for the rate of change
d u et o a i r o l ' v e l o c i t yr . r ' i t rhe s p e ctto t i m e .
resistance
t ducd.
dt''m
vtil
Downward
lem, our more generalobjective will be to illustrate (a) what numericalmethodsare and
(b) how they figure in engineeringand scientificproblen solving.In so doing, we will also
forcedue show how mathematicaln.rodels figure prominentlyin the way engineersand scientistsuse
to gravrty numericalmethodsin their work.
flGUREl.l
Forces
ociingon o
lreeJolling
bungee
iumpet.
I.l A SIMPTEMATHEMATICAT
MODET
A motlrcnntical ntodelcan be broadly definedas a tbrmulation or equationthat expresses
the essentialfeaturesof a physicalsystemor processin mathematicalterms.In a very gen-
eral sense,it can be representedas a functionalrelationshipof the fonn
The secondlaw can be recastin the format of Eq. ( 1.l) by merely dividing both sides
by m to give
F
(1.-31
n1
Becauseof its simple algebraicform, the solution of Eq. (1.2) was obtainedeasily.
However,other mathernaticalmodelsof physicalphenomenamay be much more complex.
and either cannotbe solvedexactly or requiremore sophisticatedmathematicaltechniques
than simple algebrafor their solution.To illustrate a more complex model of this kind,
Newton's secondlaw can be usedto determinethe terminal velocity of a free-fallingbody
nearthe earth'ssurface.Our falling body will be a bungeejumper (Fig. 1.1).For this case,
a model can be derived by expressingthe accelerationas the time rate of changeof the
r,'elocity(tluldr) and substitutingit into Eq. (1.3)to yield
duF
(1.4)
dt nr
where u is velocity (in metersper second).Thus, the rate of changeof the velocity is equal
to the net force acting on the body normalizedto its mass.If the net force is positive,the
object will accelerate.Ifit is negative.the objectwill decelerate.Ifthe net force is zero,the
object'svelocity will remain at a constantlevel.
Next, we will expressthe net force in terms of measurablevariablesand parameters.
For a body talling witlrin the vicinity of the earth,the net force is composedof two oppos-
ing forces: the downward pull of gravity Fp and the upward force of air resistanceFy
(Fig.1.1):
F: Fol Fti (1 . 5 )
If force in the downward direction is assigneda positive sign, the secondlaw can be
u.sedto formulatethe force due to pravity as
Fo:m8 (1.6)
due to gravity(9.81m/s2).
whereg is the acceleration
I .I A SIMPLE
MATHEMATICAL
MODEI. 7
dt: ctt t
-,5 (1.8)
,
dt tn
:r,ff*"n(
u(/) ,8,) yilt /
(1.9)
where tanh is the hyperbolic tangent that can be either computed directlyr or via the more
elementary exponential function as in
e' - e-'
tanh-t: (1.10)
e . ,* e \
Note that Eq. ( 1.9)is castin the generalfbrm of Eq. (1.1)wheret,(/) is the dependent
variable.t is the independentvariable, ctt andm areparameters,
andg is theforcing function.
EXAMPLE
I .I A n o l y t i c o lS o l u t i o nt o t h e B u n g e eJ u m p e rP r o b l e m
I MATLABG'allows
d i r e c rc a l c u l a t i o no f t h e h y p c r b o l i ct a n g e n vt i a t h c b u i l t - i nf u n c t i o nr d n h ( r ) .
MATHEMATICAL
MODELING,NUMERICAL
METHODSAND PROBTEM
SOLVING
t, 3 u,mfs
0 o
2 I B 72,92
4 33I I tB
6 42 4762
B 46 9575
t0 4 S4 2 t4
12 50 6175
516938
FIGUREI.2
Theonolyticol
solution
forthebungee problem
iumper oscompured
in Exomple
I 1 Velociry
increoseswith time ond osympfoiicolly
opproocheso terminolvelociiy.
] .I A SIMPLE
MATHEMATICAL
MODEL 9
dtt- Au u ( / i + r -) u ( t i )
- : - : Lt
dt ti+t - ti
(r.lr)
FIGURE I.3
Theuseof o finitedifference
to opproximote
thefirsfderlvotive io /
of u wifhrespect
AU
Approximateslope
-u(r,)
Ar_u(1,*,)
Lt li+t - ti
to MATHEMATICAL
MODELING,NUMERICAL
MEIHODS,AND PROBLEM
SOLVING
r'(1,,1)-u(t,l .J
:g _ _ t . t / 7 ) )-
tr+t * t; tn.
u i + :r r + ' ! u (t.13)
{1t
This approachis tbrnrally calledEuler's metlnd. We'll discussit in more detail when we
turn to diff'erentialequationslater in this book.
E X A M P L E1 . 2 N u m e r i c o lS o l u i i o nt o t h e B u n g e eJ u m p e rP r o b l e m
' P r o b l e mS t o i e m e n t . P e r f o r mt h es a m ec o r n p L l t a t i o
ansi n E x a m p l e1 . 1 b u tu s eE q . ( J . 1 3 )
to colnputevelocitywith Euler'smethod.Employ a stepsizeof 2 s fbr the calculation.
Solution. At the startof the computation(/{):0), the velocity of the jumper is zero.
Using this infbrmationand the parameter
valuesfrom ExampleI . I , Eq. ( 1.13)can be used
to corxputevelocityat 11- 2 s:
For the next interval lfiom r : 2 b 4 sJ,the colnplrtationis repeated,with the result
l- 0.2s .1
: l ( ) . 6 2+ 1 9 . 8 1- , ( 1 9 . 6 2 t - l " l:16.4117m/s
L 68.t r
I .1 A SIMPLE
MATHEMATICAL
MODEL tt
Terminalvelocity
F I G U R EI . 4
Compcrison of thenumericol
ond onclyticol for thebungeeiumperproblem
solutions
ttS u, m/s
0 0
2 r9.6200
4 36.4137
6 46 2983
B 50 r802
r0 5t 3123
l2 5 r 6008
oo 5r 6938
The resultsare plotted in Fig. 1.4 along with the exact solution.We can seethat the nu-
merical methodcapturesthe essentialfeaturesof the exact solution.However,becausewe
have employed straighfline segmentsto approximatea continuouslycurving function,
there is some discrepancybetweenthe two results.One way to minimize such discrepan-
ciesis to usea smallerstepsize.Forexample,applyingEq. (1.13)at 1-sintervalsresultsin
a smaller error, as the straighrline segmentstrack closerto the true solution.Using hand
calculations,the effort associatedwith using smaller and smaller step sizeswould make
such numerical solutionsimpractical.However, with the aid of the computer,large num-
bers of calculationscan be performedeasily.Thus, you can accuratelymodel the velocity
of thejumper without having to solve the differentialequationexactly.
r2 MATHEMATICAL
MODELINGNUMERICAL
METHODS,
AND PROBLEM
SOLVING
L/AWSlN ENGINEERING
1.2 CONSERVATION AND SCIENCE
Aside from Newton's secondlaw. there are other major organizingprinciples in science
and engineering.Among the most importantof theseare the conserv,ationlan:s.Although
they form the basis for a variety of complicatedand powerful mathematicalmodels, the
great conservationlaws of scienceand engineeringare conceptuallyeasy to understand.
They all boil down to
- decreases
Change: increases (1.r4)
This is preciselythe fbrmat that we empioyedwhen using Newton'slaw to developa force
balancefor the bungeejumper tEq. ( 1.8)1.
Although simple,Eq. (1.14)embodiesone of the most fundarnentalways in which
conservation laws are used in engineering and science-that is. to predict changes
with respect to time. We will give it a special name-the time-variable (or transient)
computation.
Aside from predictingchanges,anotherway in which conservationlaws are appliedis
fbr caseswherechangeis nonexistent. If changeis zero,Eq. (I.14) becomes
-
Change: 0 : increases decreases
or
Increases: decreases (1.r5)
Thns, ifno changeoccurs,the increasesanddecreases nrustbe in balance.This case,which
is also given a specialnarne-the stea(ly-state
calculation-has many applicationsin engi-
neeringand science.For example,fbr steady-state incompressiblefluid flow in pipes,the
flow into a junction musl be balancedby flow going out. as in
Flow in : flow out
For the junction in Fig. I .5, the balancecan be used to computethat the flow out of the
fourth pipe must be 60.
For the bungeejumper, the steady-state condition would correspondto the casewhere
the net lbrce was zeroor [Eq. (1.8) with du ldt : 0l
f
l1l$ : 6411- (1.r6)
Thus. at steadystate,the downwardand upwardfbrcesarein balanceand Eq. ( 1.| 6) can be
solvedfor the terminal velocity
P i p e2
F l o wi n = 8 0
Pipe 1 Pipe 4
F l o wi n : 1 0 0 Flow out =
P i p e3
F l o wo u t : 1 2 0
F I G U R EI . 5
A f o w b o o n c ef o rs t e o d yi n c o m p r e s s ifbuei df l o t vo t t h ej u n c l i oonf p i p e s
I.3 NUMERICAT
METHODSCOVERED
IN THISBOOK
We choseEuler's methodfor this introductorychapterbecauseit is typical of many other
classesof numericalmethods.In essence, most consistof recastingmathematical opera-
tions into the simple kind of algebraicand logical operationscompatiblewith digital com-
pllters.Figure 1.6 summarizesthe major areascoveredin this text.
l4 MATHEMATICAT
MODELING,NUMERICAT AND PROBLEM
METHODS, SOLVING
At each node
I horizontalforces (FH)= o
I vertical forces (I'u) : 0
ilH3
Electrical Conservation C u r r e n tb a l a n c e :+ i ,
engineering of charge
For each node
I current (i) = 0
I'R'
Conservation Voltagebalance:
of energy a{A&-l
,-, -R2,Jr * z- -Y f
L--\A7\--J
i:R:
Around each loop
I emf's - I voltage drops for resistors
>6->a:0
I.3 NUMERICAL
METHODSCOVERED
IN THISBOOK r5
Optimization:Solvefor x so that/'(r) = 0
Optima
lbl Part 3: Linear algebraic equations
f\x\
Giventhe a's and the b's.solve for the.r's
a ' , r xt a r 2 x . ab
=,
arrx, 1-a,x, = b2
Given
dv Av
:
,h N:flt'Yl
solve for r as a function of r
.,Ii+r= -]'i+ "f(ti,yJAr
FIGURE
I.6
of thenumericol
Summory methods inthisbook.
covered
t6 MATHEMATICAL
MODELING,NUMERICAT AND PROBLEM
METHODS, SOLVING
PROBTEMS
l.l Usecalculusto velity that Eq. (1.9) is a solutionof 1.7 Thc amountof a uniformly distributedradioactivecon-
E q (. 1 . 8 ) . taminant containedin a closed reactor is measuredby its
1.2The following infbrmation is availablc for a bank concentrationc (becquerel/literor Bq/L). The contaminant
acc0unt: decrcasesa1 a decay rate proportionalto its concentration;
that is
Dote Deposits Withdrowols Bolonce Decay rate : -tc
5ir I 5 I 2 .3 3 whereft is a constantwith units of day I. Thercfore,accord-
2 2 41 3 327.26 ing to Eq. (1.14),a rrass balancefbr the reactorcan be
6/l wntten as
2t6B0 3 7 86 1
7/l dc
, r ( nr < r 0 68 0 kt
dt
Bit
/ changc\ / decrease \
t 2 7. 3 1 3 5 06 r t .i"ntm: ta,rls
9ll \ / \ U l d e c a S
/
or, sincethe surfaceareaA is constant nr the heat capacity,and thc changein temperatureby the
followingrelationship:
r/t'O.O
: :3: s i n - f t )_ :
drAA - rr)
o : - Ir': c,dr : nrc,,(rz
Use Euler's method to solve for the depth _vfron-rr : 0 to
I0 d with a step size of 0.5 d. The parametervaluesareA : The massof air can be obtainedliom the ideal sas larv:
1200m2 and p : 500 m3/d.Assumethat the initial condition
i s . y: 0 . nt
-P7
Plt :
1.9 For the same storagetank describedin Prob. 1.8, sup- Mwt
pose that the outflow is not constantbut rather dependson
the depth. For this case,the differential equationfbr depth where P is the gaspressure,V is lhe volume of the gas,Mwt
can be written as is the molecularweight of the gas (1br air 28.97 kg/krnol),
and rRis the ideal gas constant[8.31,1kPa m]/(kmol K)].
dl' O . a(ltr')r 1.12 FigureP1.12depictsthe variousways in which an aver-
= . 1 ; s i n - (tr-
dt A ilgeman gainsandloseswaterin oneday.One liter is ingested
as food, and the body metabolicallyproduces0.3 liters. In
Use Euler's method to solve for the depth )' fiom t : 0 to breathingair, the exchangeis 0.05 liters while inhaling, and
10 d with a step siz-eof 0.5 d. The parametervaluesareA : 0.4 literswhile exhalingover a one-dayperiod.The body will
1200m2,O:500 mr/d, and cv: -300.Assurnethat the ini- also lose 0.2, 1.4.0.2.and 0.35 litersthroughsweat,urine,
tial condition is _r: 0. feces,and throughthe skin, respectively.To maintainsteady
1.10 The volume flow rate through a pipe is given by Q : state,how much water must be drunk per day?
rA, whele u is the average velocity and A is the cross- l.13 In our example of the fiee-falling parachutist,we as-
sectionalarea.Use volume-continuityto solvefor the required sumed that the accelerationdue to gravity was a constant
areain pipe3 of Fig. P I . 10. value of 9.8 m/s2.Although this is a decentapproxinration
l.ll A group of 30 studentsattenda classin a room which when we are examining falling objectsnear the surtaceof
lneasuresl0 m by 8 m by 3 m. Each studenttakesup about the earth, the gravitational lbrce decreasesas we lrove
0.075 mr and gives out about 80 W of heat (l W = I J/s). above sea level. A rnore general representationbased on
Calculatethe air temperaturerise during the first l5 minutes Newton's inversesquarelaw of gravitationalattractioncan
of the class if the room is completely sealedand insulated. be written as
Assume the heat capacityC,. tbr air is 0.7 18 kJ/(kg K). As-
sume air is an ideal gas at 20 "C and 101.325kPa. Note that R:
s ( x ) : g ( 0 ) ( l-( + . r ) '
the heatabsorbedby the air O is relatedto the massof the air
Skin
Drink
u.,ou, = 6 m/s
A:=? Metabolism
F I G U R EP I . I O F I G U RPEI . I 2
PROBLEMS r9
whereg(r) : gravitationalaccelerationat altitude.r (in m) of your final computedvolume and verifying that it rs con-
measured upward fronr thc earth'ssurfacetm/s2).gtO) : sistentwith the evaporationrate.
gravitational accelerationat the earth'ssurface(! 9.8 rn/sr), l.l-5 Newton's law oicooling saysthat the temperatureof a
a n dR : t h ec a r t h ' sr a d i u s( = 6 . 3 7 x 1 0 6m t . body changesat a rateproportionalto the differencebetween
(a) In a fashionsimilar to the derivationof Eq. (1.8), use a its temperatureand that of the surroundingmedium (the am-
forcebalanceto derive a ditlerential equationfor veloc- bient temperature).
ity as a function of time that utilizes this more complete
d
-; T : - k ( T - T " )
representation of gravitation.However. lbr this deriva-
at
tion, assumethat upward velocity is positive.
(b.1For the casewhere drag is negligible,use the chain rule where Z: the temperatureof the body ("C), r : time (rnin),
to expressthe differentialequationas a function of alti- k : the proportionalityconstant(per minute), and 7, : ths
tuderatherthan time. Recall that the chain rule is arnbienttemperature("C). Supposethat a cup of coft-eeorig-
du du d-r inally has a temperatureof 68 'C. Use Euler's method to
computethe temperaturefrom I : 0 to l0 min using a step
dt d.r dt
sizeof I min if I.. : 2l "C and ft : 0.017/min.
(c) Use calculusto obtain the closed form solution where |.16 Afluid is pumpedinto the networkshownin Fig. P1.16.
u = u,,at.r : 0. lf 0, : 0.6.O.,: 0.4.Qt:O.2. andQo: 0..1mr/s.determine
(d) UseEuler's rnethodto obtain a numericalsolutionfrom the other flows.
r : 0 to 100,000m using a stepof 10,000m where the
initial velocity is 1400m/s upward.Compareyor,rrresult
u ith the analyticalsolr"rtion.
l. l{ Supposethat a sphericaldroplet of liquid evaporatesat
ilr*?-i=-i--I
iiri:;$
a ratethat is proportionalto its surfacearea.
dV
::
dt
-kA
bt'ili o,l "i "i "'i
rvhereV: volume 1mm3),t : time (hr), k : the evapol'ation
rate(mm/hr), and A : surface area 1mmr). Use Euler's
methodto conrputethe volume of the droplet from I : 0 to
i-.er-:--s...;-*-*L*-i
l0 min using a step size of 0.2,5min. Assume that ft :
0.1mm/min andthat thedropletinitially hasa radiusof 3 mm.
FIGURE
PI.I6
the validity oi your resultsby determiningthe radius
Assess
\
iiEi;4+'"
,l
i.
MATLABFundomentols
2.1
CHAPTER
OBJECTIVES
The primaryobjectiveo1'thischapteris to providean introductiorr
and overviewof
how MATLAB's calculatormodeis usedto implcmentinteractivecornputations.
Specificobjectivesand topicscoveredare
' Lcarninghow realanclcornplexnurrrbcrs areassignedto variables
. Learninghow vectorsand matricesareassignedvaluesusingsinrpleussignrnent.
.l
the colon ope'rator', and thc irs;p.r,:cand 1oq1,;piic:,--- l'ttnctitlns.
. Llnderstanding thc priority rulcsfirr constructingmathernatical cxpre-ssions.
. Gaininga gencralundcrstanding ol'built-in lr-rnctions and how you can lcarntnore
a b o u t h e mw i t h M A ' I ' L A B ' sH e l p f a c i l i t i e s .
. Learninghow to usc vectorsto crcirtca sinrplclinc plot baseclon an equation.
tsi
V t,t
m8
( 2 .I ;
ut
20
ffi=?N 4_ =
,f %. uE-1 5t
zr'+ zl x+ %I
2r
MAT4gllyllerynENl
2 r THE
TABTE2.I Dotoforthemossondossociotedtermino|velociliesofonumberofiumpers
BO9
gll 929 653
836 6A2 721 4 7 7 5l l
m,kg (1,,1 la \ 509 557 5 4
u,,ml s
of knclwnmass,this
the terminal velocityof a numberol .iumpers
Thus, if we nleasure The clatain Table2' I werecol-
provides o *t-' tt.lestimatethe drag coeificient'
equation
l e c t u ' ldo r l h i s p u r p o s e ' r n : r l v . ztr ' s r rdclht u . B e y o n d
^ m , ^ n ^ ^ ^ , . ^ , , . n r rl n analyze
chapter, we will leartr how MATLAB canbe uscdto
In this
showinghowMATLABcanbeenlployedtocolnputeqtrantitieslikeclragcoetTicients'we
willalsoillustratchowttsgraphicalcapabilitiesp,*i.t.adtlititlnalinsightintosuchanalyses.
2.r
M A T L A B i s a c o m p u t e r p r o g r a l x t h a t p r o v i < l c s . t hiteprtlvides
u s e r w i ta
h avery v e l rtool
c o nnice e ninrple.
i e t r tto virontlrentfclr
typcs.ol.ctilculaticrns. ln particular,
perfornirrg many
rcsult'
MATL.AB will disPlaYthc
a,ttt-,=,,
8
ffi
qA b
zt\
4x
^r-
AL
?t 5t
4
,.-ILJ' !8
22 MATLABFUNDAMENTALS
50
MATLAB assignsthe resultto ans wheneveryou do not explicitlyassignthe calculation
to a variableof your own choosing.
2.2 ASSIGNMENT
Assignmentrefersto assigningvaluesto variablenames.This resultsin the storageof the
valuesin the memorylocationcorresponding to the variablename.
2.2.1 Scolors
of valuesto scalarvariables
The assignment is sirnilarto otherconlputerlanguages.
Try typing
1 _ A
4
Echoprintingis a charactelistic
of MATLAB. lt carrbe suppressed
by terminatingthecom-
mand line with the semicolon(; ) character.
Try typing
>> A = 5;
You can type severalcommandson the sameline by separating them with comnlasor
semicolons.If you separatethem with commas,they will be displayed,and if you usethe
semicolon,they will not.For example,
>> a - 4,A = 6;x = . 1;
twe
short
4 Iong
short e
MATLAB treatsnames in a case-sensitivernanner-that is. the nan)e a is not the same
long e
as the name a. To illustrate this. enter
long g
>> a
eh^rt end
and then enter
long eng
>>A
bank
Seehow their valuesare distinct.Thev are distinct names.
frT-Tbl -z th
"L x jj€- -r
zfTtr ='1.t- st
.-f J
4 _A
15/
zl-+ Z] X+? I
2.2 ASSIGNMENT 23
2.0000 + 4.0000i
It shouldbe notedthat MATLAB allows the symbol j to be usedto representthe unit imag-
inary numberfor input.However,it alwaysusesan i for display.For example,
>> x = 2+1*4
2.0000 + 4.0000i
Thereare severalpredefinedvariables.fbr example.pi.
>- pi
3 . r4r6
Noticehow MATLAB displaysfbur decinralplaces.If you desireadditionalprecision,
enterthe fbllowing:
>> format long
1 . 1 4 1 5 9 2 b 5 - 15 8 9 7 9
The f<rllowing is a summary of the format commands you will employ routinely in engi-
ncering and.scientific calculations.They all have the syntax: f ormat typr...
- c h o ]t S c o e d f i x e dp o i n t f o r m c tw i t h 5 d i g i t s 3. r416
Lcrng S c c r i e df r x e d - p o i nfto r m o iw i t h 1 5 d i g l h f o r d o u b l e o n d Z d i g i t sf o r s i n g l e i.1415q1b5J58979
srrort e F l o o i i n g ' p o i nfto r m c tw i i h 5 d i q i t s l.1415e+0tr0
lonlJ e F l o o i i n gp o i n t l o r m o tw i f h l 5 d i g i i s f o r d o u b l e o n d / d l g i t sl o r s i n g l e 3 . 1 4l 5 9 2 6 5 3 5 8 9 7 9 3 e + 0 0 0
shorl: g B e s lo f f i x e d o r f l o o f i n g - p o i nl ol r m o tw i t h 5 d i c t l t s 3.r416
lonq g B e s to [ [ i x e d o r f l o o t i n gp o i n l f o r m o fw i t h 1 5 d l g i t sf o r d o u b l e 3 . 1 4 1 5 9 2 . 6 5 ] , 5 8 997
andTaglsforsingie
short eng E n g i n e e r l n gf o r m o fw i t h o l l e c s l5 d i g i t so n d o p o w e r i h o t i s c r r n u t l p l eo f 3 1.1416er000
long eng Engineen r g f o r m o tw i i h e x c c l l y 1 6 s i g n i f i c o ndt i g i t so n d o p o w e r 3 . 1 4 1 5 9 26 5 3 5 8 9 79 e + 0 0 0
t h o t s o m ut i p l eo f 3
bank F i x e dd o l l o r so n d c e n t s 1 1A
ffiE\
z\ a-*!1,€
--T -
-a.[h
-_- a --:-----;:a,
+ .__..__i
. I el 5t
'"1F{'J 4
el + Z} X+ I
24 MATLABFUNDAMENTALS
or
_-..>b- |2;
1;
6;
8;
I0 l
r'23
456
789
In addition.the Enterkey (carriagereturn)can be usedto separirte the rows. For example.
in the followingcase,the Enterkey woulclbe struckafterthe 3. the 6 andthe I to assignthe
matrix:
.->A.. lr23
456
7 8 9l
ffi
qA1, "L x jl':-
<, lh
-r
a_J---*=
zf :5yst
LIZ _r -{ vI ?l 5t
zt -+
4
Z] X+
, - A
I
2.2 ASSIGNMENT 25
f Jd r { i e Sr ze Byte:: Class
A lx3 12 clouble array
I x5 40 cloubLa array
dns LXL 8 tlouLr Lc: ;.Lrray
l) 5xi 4Ct il,trrb l e i)i I'ay
'1
x- xl I6 doubLe arr.r.y
(comfiLex)
,tlt si .
F o r a n a r r a y , A ( n, rn ) s e l e c t s l h e c l e m c n t i n m t h r o w a n d t h c n t h c o l u r n n . F o r e x a m p l e ,
A(:,1)
00
UU
u = o n c : : ;( j , - l)
-
ffial <,
- [h
z$4 I
la-
s L Y
t('€ - ?'' 5l
zf Ll 2 ;n-Zt*
-i
5t
vI
zl' -+ Z] X+
'|-A
I
26 MATLABFUNDAMENTALS l.J
t0 9 B 1 6 5
Aside from creatingseriesof numbers,the colon can also be usedas a wildcard to se-
lect the individualrows and columnsof a matrix.When a colon is usedin placeof a spe-
cific subscript,the colon reprcsentsthe entire row or column.For example,the secondrow
of the matrix A can be selectedas in
>> A(2,:)
981
Thus, the second through the fourth elements are returned.
Res
2.2.4 The rlnspace ond losspace Functions plv
The iinspacre and logspace functionsprovideotherhandytoolsto generatevectorsof thes
spacedpoints.The 1 inspace functiongenerates
a row vectorofequally spacedpoints.It ing
has the form
I i n s p a c e (x l . x 2 , n )
which generatesn points betweenxl and x2. For example
'> linspace(0,1,6)
Th
AS
0 0.2000 0.4000 0.6000 o.BOOO 1.0000
lf the n is omitted,the function alromatically generates100points.
The logspace l-unctiongenerates a row vectorthatis logarithmicallyequallyspaced.
It has the form
).
-t
logspace(x1, x2, n)
ffi= -tlh
"L x
Ll 2. * Zl eNst vI 2- 3l
J
?l -+ ZI X+? =$8
2.3 MATHEMATICAL
OPERATIONS 27
2.3 MATHEMATICAL
OPERATIONS
Operationswith scalarquantitiesare handledin a straightforwardmanner,similar to other
computerlanguages.The common operators.in order of priority, are
Exponenliolion
Negotion
M u l t i p l i c o t i o no n d d i v i s i o n
L e f td i v i s i o n ' l
A d d i t i o no n d s u b l r o c t i o n
,r 2*pt
6 .2,832
Also, scalar real variables can be included:
>> Y - Pt/4;
>> y ^ 2.45
0.5533
>> Y = 4 ^ 2
y-
_r6
L6
: Lefi division appliesto matrix algebra.It will be discussedin detail later in this book.
ffi= <, [h
-----
,"1lJ t
r\ a +
-
-=-:-T
*-6 -l 5[ s\
-{
.l - "L x
__..-..-..i,
4 6re
zl'+ Z] X+ %&
2a MATTABFUNDAMENTAIS
ans -
5.0004 +I2.0000i
>>'1 /;<
0 . 1 0 1 10 0.2000r
>> x ^ ,2
ans -
-12.0000 +1r,.0000-r
>> x + y
an!; -
lB.O0tJ0 + 4.00001
The real power of MATLAB is illustrated in its ability to carry out vector-rnatrix
. l t h o u g h w e w i l l d e s c r i b es u c h c a l c u l a t i o n si n d e t a i l i n C h a p . 8 . i t i s w o r t h
c a l c u l a t i o n sA
introducing sorne of those manipulations here.
The irtner product of two vectors (dot product) can be calculated using the * operator,
:.:,d*b
r10
>:, b * -
allS -
2 4 b 8 I0
4 8 12 16 20
6 12 18 24 30
8 16 24 3'2 4t)
10 2t) l0 4L) 50
. , ti 2 l;
and
>> b = f4 5 tjl';
Now. try
>> a * A
l0 t6 4?.
ffir
qAb Z
uNx
<,
- [h
>>A*b
32
71
r22
Matrices cannot be multiplied if the inner dimensions are unequal. Here is what happens
when the dimensions are not those required by the operations. Try
>> A * a
MATLAB automatically displays the error message:
??? ETrar using =-> mtimes
Inner matrix dimensi.ons must aQfree.
Matrix-rnatrix multiplication is carried out in likewise fashion:
>> A * A
30 35 42
66 B1 96
102 126 150
Mixcd operations with scalarsare also possible:
>> A/pi
ans =
0.3183 0.5366 0.9549
'I
.2132 I.5915 1.9099
?,.2,?,82 2,.\46\ 2,.8648
We must always remember that MATLAB will apply the simple arithmetic operators
in vector-matrix fashion if possible.At times, you will want to carry out calculations item
by item in a matrix or vector. MATLAB provides for that too. For example,
30 35 4?,
66 81 9tr
r02 t2,6 1 50
resultsin matrix multiplicationof a with itself.
What if you want to squareeachelementof e? That can be donewith
>> A .^ 2
anS =
r49
16 2a 36
49 64 81
^
The . precedingthe operatorsignifiesthat the operationis to be carriedout elementby
element.The MATLAB manualcalls thesearray operatlons.They are also often referred
Loas element-hy-cIemen t t tparutit tn.s.
ffi
z\4 "L
<, lh
x _-T - 9f 5l
,"I LJ' Zl- gt st
-l
4 ,t\€
-l-
-2.(-h z_|lh I
30 MATLABFUNDAMENTALS
PressingEnter will perform the calculation again. But you can also edit this line. For
example,changeit to the line below and then pressEnter.
>> A .". 3
1821
64 I25 216
343 5r2 129
Using the up-arrow key, you can go back to any command that you entered. Press the up-
arrow until you get back the line
F * -
Alternatively,you can type b and pressthe up-arrow once and it will automaticallybring
up the last commandbeginningwith the letter b. The up-arrow shortcutis a quick way to
fix errorswithouthavingto retypethe entireline.
One of their importantpropertiesof MATLAB's built-in functionsis that they will op-
eratedirectly on vectorand r.natrixquantities.For example,try
>> log (A)
0 0.6931 1.0986
1.3863 1.6094 r.79'LB
1.9459 2.0194 2.1912
and you will see that the natural logarithm function is applied in array style, element by
elenrent,to the matrix A. Most functions. such as sqr t, abs, sin, acos, f anh, and exp, op-
erate in anay fashion. Certain functions, such as exponential and square root, have matrix
definitions also. MATLAB will evaluate the matrix version when the letter m is appended to
ffi=
qA+, "L
<'- [h
Y - eJ 5t
a eys\
'\--
,"1{z -1 -l 4 ll'€
zf+ Z] X+ &
FUNCTIONS
2,4 USEOF BUILT-IN 3l
There are several functions for rounding. For example, suppose that we enter a vector:
>> round(E)
-2-2-1r22
The ceil (short fbr ceiling) function rounds to the nearestintegerstoward infinity:
1 1 -1 2 2 2
The f loor function rounds down to the nearestintegers toward minus infinity:
>> f loor ( F t)
22 2rl
There are also functionsthat perform specialactionson the elementsof matricesand
arrays.For example,the sumfunctionreturnsthe sum of the elements:
>> F = l3 5 4 6 Il;
>> sum(F)
19
In a similar way, it should be pretty obvious what's happeningwith the following commands:
3.8000
360
13456
ffi Z} x --T<, lh
,f\€ - 9f >l
4 -l-
&
32 MATTABFUNDAMENTALS
t.-
0
2
4
6
B
l0
t2
l4
15
1B
20
Check the number of items in the t array with the lerrgLh function:
allS =
1I
M A T L A B a l l o w sy o u t o e v a l u a t ea f o r m u l as u c ha s r : . 1 ( r ) , w h e r et h e f b r r n u l ai s
computedfbr each value of tl.rer array,and the result is assignedto a correspondingposi-
tion in the u array.For our case,
-/ : s q L t - ( g * n / c ' d ) * 1 - a n h ( s q r t ( g * c c l/ n ) * t )
t) (
1B.'t292 (
33.r118 I
42 .01 62
46 .951 a
49 .42r4
50.6175
51.1871
51.4560
51.5823
br.6416
-
ffir <,
- [h
L x
j_f€ - sJ 5t
zl Llz 7f 5[ st
-{ -l vI
.r1 -\
zl'+ Z] X+?
2.5 GRAPHICS
33
2.5 GRAPHICS
createa
MMLAB allows graphsto be createdquickly and conveniently.For example,to
graphof the t and v arraysfrom the data above,enter
:,., nlol (t, ./)
lne gfapn appears ln tne grapnlcs wrnoow ano can De pnnteo or translerreo vra tne clrp-
board to other programs.
60
50
40
30
20
10
0
8 10 1214 16 18
Plot of u versus f
60
:
.'
l
t '!ry
50 l l
i I
40 l
l
a I
o i
: 30 : j
i
6
I !
20
I, i
.-..--- t. "- -
:
10 "-t--*
l
I
i
l I
0
8 10 12 14 16 18
Valuesof t
ffi
z\4+ a-* --4
<, lh
l,f.€- ef >l
,"lqfjeTl ^:,z,J -l-
?,r' zl x+ 3$&
34 MATLABFUNDAMENTALS
ln contrast,the f<lilowingcommandswould
resurt in both lines and symborsbeing
displayed:
ffi
aAI z-t\ a.
- [h
- =,:st -x
7l Lt r --7i 5[ v! rf € - 1 5t
J'-l J-l
zt'-+ Z-} X+
2.5 GRAPHICS 35
As in Fig. 2.la,the result is a circle. Note that the circle would have been distorted if we
had not used the axis sou.er e command.
F I G U R E2 . I
A twoponeplotof (o)o two-dimensionol
circleond (b)o three-dimensionoJ
helix
(b)
ffi=b "L Y
<, lh
_-T
5t(st j} € - eJ 5t
,"I LJ' 1t
-l
vI
z['+ Z] X+ 3$8
36 MATLABFUNDAMENTALS
Now, let's add the helix to the graph'sright pane.To do this, we againemploy a para-
x: sin(/),.)': cos(1),andu : /
metl'icrepresentation:
' > s u b p L o t (- I , 2 , 2 ) ; p 1 o t 3 ( s i n ( L ) , c o s ( 1 . ) , L ) ;
>> rirle('(b) ,)
The resultis shownin Fig. 2.l b. Can you visualizewhat'sgoingon?As time evolves.
the .r and .y coordinatessketchout the circumferenceof the circle in the r-r' plane in the
samefashionas the two-dimensional plot. However.simultaneously. the curverisesverti-
cally as the : coordinateincreaseslinearlywith time. The net resultis the characteristic
springor spiralstaircase shapeof the helix.
of graphicsthat are useful-fbr example.plotting obiects
Thele ale other f'eatr.rres
insteadof lines,familiesol curvesplots,plottingon the complexplane,log-logor semilog
plots,three-dimensional meshplots,and contourplots.As describednext,a varietyof re-
solll.cesareavailableto learnabouttheseas well as otherMATL,AB capabilities.
2.6 OTHERRESOURCES
The fbregoingwas designedto lbcus on thosef'eatures ol'MATLAB that we will be using
in the remainderof this book.As such.it is obviouslynot a comprehensive overviewof all
o1'MATLAB's capabilities. If you are interestedin learningrnore,you shouldconsultone
of the excellentbooksdevotedto MAILAB (e.g..Palrn.2005;Hanselmanand Littlefield.
2 0 0 5 :a n dM o o r e . 2 0 0 7 ) .
Further,the packageitsell'includes an extensiveHelp lacility thatcan be accessedby
clicking on the Help nrenuin the comnrandwindow.Thi.swill provideyou with a nutnber
of ditl'erentoptionsfbr exploringand searchingthloughMATLAB's Help material.In ad-
dition, it prclvidesaccessto a numberof instructivedetnos.
As describedin this chiLpter. help is also availablein interactivernodeby typing the
lrclp conrmandfbllowedby the narneo1'acommandor function.
If you do not know the narne,you can use the lookfor commandto searchthe
MATLAB Help files lbr occurrences of text.Fol example,supposethatyou wantto find all
the cornrnands and functionsthat relateto logarithrns, you couldenter
ffiar a,
- [h
--=-al' "L x
z[ Ll 2 r
5y 5t
-r 4 1.|€- 1 5t
zl ,x+ =$8
L1 -l_t
zl'+
2.7 CASESTUDY 37
EXPLORATORY
DATAANALYSIS
Bockground. Your textbooks are filled with formulas developed in the past by
renowned scientistsand engineers.Although theseare of great utility, engineersand scien-
tists often must supplementtheserelationshipsby collectingand analyzingtheir own data.
Sometimesthis leads to a new forrnula. However, prior to arriving at a final predictive equa-
tion, we usually "play" with the data by per{ormingcalculationsand developingplots. ln
most cases,our intent is to gain insight into the pattemsand mechanismshiddenin the data.
In this casestudy,we will illustratehow MAILAB facilitatessuch exploratorydata
analysis.We will do this by estimatingthe drag coefficientof a free-falling human based
on Eq. (2.1) and the data from Table 2. 1. However, beyond merely computing the drag
coefficient, we will use MATLAB's graphicalcapabilitiesto discernpatternsin the data.
The drag coefficientscan then be computedwith Eq. (2. l). Becausewe are performing
element-by-element operationson vectors,we must include periodsprior to the operators:
We can now use someof MATLAB's built-in functionsto ceneratesome statisticsfor the
results:
- . . - 1 , J , 1 r 7 q = 1 1 r ( ' . (l (a i l l l i , i i r = t i ri r r ( .l r , n , . ,r , , , 1 , 'q1 ( r ' r l )
i Li,-.1';1,1 ,.
l) . .l llr;4
r l c l r r ri r r -
i)
r ' c l n t . r: .
0. J12!
Vpl t r:Ci
'rl-t,(lL'r 1i,..iii,)/ 4'1. /!.1l'-r'r.ll1r',tr:,
'.1),.i
] ,) f "
Notice that we do not have to use periodsprior to the operatorsin this formula? Do you
understandwhy?
We can plot thesevaluesversusthe actualmeasuredterminal velocities.We will also
superimposea line indicating exact predictions(the l;1 line) to help assessthe results.
ffi=
qA+,
-z [h
x - eJ 5t
z(r Ll 2 2- e[ st /_l€
tr4 -\
-{
,e[r ?$ I
+ Z] X+?
38 MATLABFUNDAMENTALS
3ss
€0)
o-' 50
45L
48 49 50 51 52 53 54 56
Measured
0 . 2|
60 65 70 75 80 85 95
Mass (kg)
PROBTE
FIGURE2.2
withMATIAB
Twoololscreoted 2.1 A simple electricc
pacitor, and an inductor
on the capacitor4(l) as
Becausewe are going to eventually generatea secondplot, we employ the subplot as
command:
' ' : : u l . , y r l o L( 2 , ) , 1 ) ; p l o t ( " / t - , v p r ( . 1 ( ,l ' . ) ' , ' , ' 1 . , v l - )
., x I a b , - l ( ' l r , : , , t : ; L r r i : c l)' q(t): q t ) g - R t / ( 2s1
I i.rlrt'I ('Irr i.:rlic lL-'tl')
'l'l ol Lrurar(l l,
I i t lc] ( ol I)t ('(l i ( t..crd
wherer:time,qo:tl
L: inductance,and (
As in the top plot of Fig.2.2,becausethe predictionsgenerallyfollow the l: I line, you
generatea plot of this fi
might initially concludethat the averagedrag coefficientyields decentresults.However,
4o:12,R:50'L-j
notice how the model tends to underpredictthe low velocitiesand overpredictthe high. 2.2 The standard norrr
This suggeststhat ratherthanbeing constant,theremight be a trendin the dragcoefficients. bell-shapedcurve that c
This can be seenby plotting the estimateddrag coefficientsversusmass:
x l ; r i r e I ( ' n r , r : r f , r( k q r ' t
' , ' l , i ' l : rl, ( ' , - ' : : 1 i t n a l ' t , r l L l r , t g r : t , [ ' l ' I i c t l l r l ( ] i q / 1 l l)
,)
L i 1 . L e 1 ' ; ; L i r l - O I c 1 L . i . - l] r o l r i I i . i c t l L \ " r r : . i 1 1 l rf li l , l Use MATLAB to ger
The resulting plot, which is the bottom graph in Fig. 2.2' suggeststhat rather than z: -4 to 4. Labelth
scissaasz.
being constant, the drag coefficient seems to be increasing as the mass of the jumper
ffi=
llAb : "L x
<,
- [h
rtE-:l 5
:
vI
zl'+ Z] X+? I
PROBLEMS 39
continued
PROBTEMS
2.1A simplcelcctlic circuit consistingol' a rcsistur,a ca- 2 . f U s c t h c I i r : r p , r c e l ' u n c t i o nt o c r c a t c v c c t o r s i d c n t i c a l t o
pacitor,
andan induc(oris dcpictcdin Fig. P2.l. T'hcchargc t h c l i r l l o w i n g c r c a t c c lw i t h c o k l n n o l a t i o n :
onthecapacitor
ri(t) as a lirnctionol'limc can bc cor.nputcd (a) t : !:{r:-JlJ
as (b) r: t,:,.1
2.4 Usc colon notution lo crcatc vectors idcntical to the
l i r l l o w i n g c r c u t c dw i t h t h c I i n : , [ ) , ] .r : l i r n c t i o n :
\/ llt
Resistor
UseMATLAB to gencrate a plot ol' this fbnction liom
;=-,1 to.1. Labcl thc ordinateas lrcquencyand the ab- F I G U R EP 2 . I
scissa
as:.
ffir
qA+,
<,
- [h
x
,"1{t 6 e[st
-l -l
1-l€- eJ 5t
zt'+ Z] X+ 8,
40 MATLABFUNDAMENTALS P
where k : the spring constant(N/m). The potentialenergy 2.8 lt is general practice in enginceringand sciencc that 2.13 You conractthe jur
storedin the spring U (J) can then be computedas equationsbe plotted as lines and discretedata as syrnbols. Table 2.1 and measure
Here is somcdatafbr conccntration({) \'elsustimc (l) for the values, which are order
l-
U: -(.r- photodegradation of aqueousbromine: conespondingvaluesin T
2
Five springsare testcdand the following data compiled: A,m2 o45A O4OlO
t, min t0 2A 3C 40 50 60
c, PPm 414 26 t6 t3 i0 c5
F,N ll )2 l5 9 t2 (a) If the air density is p
r,rr 0013 0020 0C09 0010 0012
compute values of tl
This datacan bc dcscribedby the lbllowing function:
cD.
(._ 4.g4.,.00r.1/ (b) Determine the averag
LlseMATLAB to storeF and,t as vectorsand thcn conrputc
resultingvalues.
vcctorsof the spring constantsand the potentialenergics.
Usc MATLAB to crci\tc a plot displayirrgboth the data (c) Develop a side-by-si
Use thc max l-unctionto dcterminethe maxirnumpotential
(r-rsingsquarcsymbols)and the function (using a dotted C, versusrr (right sic
cncruy.
l i n e ) .P l o tt h c l u n c t i o nl b r r : 0 t o 7 5 r n i n . and titles on the plots
2.6 The densityoi treshwater canhe computedasa lunction
2.9 The senii 1o9i, lunctiont)pcratcs in an idcnticalfashion 2.14 The following para
ol'tcmperaturcwith the firllowinecubiccquation:
to thc frlot, lirnction cxccpt that a logarithrnic(basc-10) that contractsexponentia
p: - 5 . - 5 2 8x9 l 0 - 8 f ( l - 8 . - 5 0 1 x6 t o ' - 6 7 < ? scale is used lirr thc l axis. Usc this l'unctionto plot the - srnI
-ll l, .
.r:c
s data ancl l'unctionas dcscribcdirr Prob. 2.t1.Explain thc nt ,
i 6.5622x l0 11 + 0.99987 .v=e cosl
result s.
whcre p : dcnsity (g/cnr31and 16' : tcmperat.urc('C). Usc 2.1() Hcrc is sorncwirrd tunncl data lirr lirrcc (I-) vcrsus
MATLAB to gencratea vcctor of tcrnpcraturesrangingliorn v e l o c i t y( r ' ) : Use subplor to genera
32 "F to 82.-1'F usingincrcrncntsof 3.6 oF.Convcltthrsvcc- (.r, .y) in the top pane and
tor tclclcgrecsCelsiusanclthe'ncomputca vcclorof dcrrsitics (x,.v,l) in the bottompane
-i"1.. u , m l s 1 0 ? . 0 3 0 4A 50 60 7A B0
hascdon the cubic lbrmula. Crcatea plot ol'p vcrsus 't5 7A 3BO 2.15 Exactly what will t
: -
519(7'F 32).
I t , N 5 5 0 6 r 0 t 2 2 A 8 3 0 1 450
Rccallthat T( MATLAB commandsare I
2.7 Manning'scquationcanbc uscdto compulcthc vclocity (a)>>x=z;
01'wirtcrin a rectanglllar
opcn channcl: >> x ^ 3;
This clatacan bc describcdhy thc lirllowingl'ur.rction: >>Y=B-x
. /s/ BH \t'
rt \B+2H/ I" : 0.2711ttt')x+t (b) rt q = 4:2:L0;
>> r - 17 B 4; 3
whercU: r,clocity(nr/s),S: channelslopc,n: roughncss LJsr'MATLAB to crcatc a plot displayingboth thc data >> sum(q) * r(2,
Ii: yu;.1,1.r
cocfl'icient, (nr),and /1 : dcpth(rn).Thc lirllo',v- (usingdiantondsymbols)and thc llnction (usirrga dottcd
ing datais availablclbr I'ivechannels: l i n e ) .P l o tt h c l u n c t i o nl i r r u : 0 t o 9 ( )n r / s .
2.ll Thc loc_{locr lirnclionopcratcsin an idcnticalI'ashion
n5BH to the fil()'. lirnction cxccpt(hatlogarithnricscalcsarc uscd
lirr both thc,r ancl.r'axcs.Usc this lunctionto plot thc dau
0 035 0 0001 t0 2 and lunctionas dcsclihcdin Proh.2. I0. Explaintlrc rcsults.
0.020 0 0002 B I 2.12 Thc Maclaurinscricscxpansiontirr thc sinc is
00r5 oo0to l9 t5
'24 3
0 030 0 0008
t5 '25 . .r'l .r5 ,r7 .r'')
a a22 0 0c103 Sln,I=-t-- + +--
.r! 51 71 9l
Storethesevaluesin a matrix whereeachrow reprcscntsone Use MATLAB to creatca plot o1'thcsine(solid linc) along
oi'thc channelsandcachcolumn representsone of the paranr- r.vitha plot o1'thcscriescxpansion(dashedline) up ttr andin-
ctcrs.Writc a single-lineMATLAB statcmentto conputc a cluding the terni -r7171.Usc the Lruilt-intirnctionf .rct1)r
column vectorcontainingthe vclocitiesbasedon the virlues ial in conrputingthe scriesexpansion.Make the rangeof
in the parametermatrix. the abscissali'onr,r : O to 3tr 12.
+fi6-qrlal
4-t
zl 4+ a. th
-r
jlg- 1 5t
-----j
.l
z['+* Z] X+? I
PROBTEMS 4l
2.13You contactthe jumpers used to generatethe data in 2.16 The trajecbry of an object can be modeledas
Table2.1 and measure their frontal areas.The resulting
values,which are ordered in thc same sequenceas the R.
):(tando).\--r'*)t,
conespondingvaluc-sin Table 2. l, are IU;COs.d0
A,nt2 0.454 0 401 0 453 0 485 0 532 a 474 A 4B6 where _v: height (m), d,, : initial angle (radians),r :
horizontal distance (m), g = gravitationalacceleration
( : 9 . 8 1 m / s r ) ,u , , : i n i t i a lv e l o c i t y( m / s ) ,a n d y , , : i n i t i a l
find the displacementfbr r',, : Q
(a) Il the air densityis p : 1.225kg/mr, use MATLAB to height. Use MATLAB to
and r,,:30 nr/slbr initial angle-s rangingliom l5 to 75o in
computevaluesof the dimensionless drag coefficicrrt
increrncnts of 1,5".Employ a rangeof horizontaldistances
cD.
(b) Deternrine from -t : 0 to 100m in incremcnts of 5 m. Thc resultsshould
the average,minimunrand rnaxirlumol'thc
be assernblcd in an array where thc first dimension(rows)
resulting values.
distances.and the seconddimension
(c) Dcvelopa side-by-side plot ofA versusrr (lcft sidc)and correspondsto the
(columns)correspondsto the difl'erentinitial angles.Use
C.,versusrr (right side).lncludedescriptivcaxis liibels
this matrix to gcncratea singlc plot of thc hcightsversus
andtitlcson the plots.
horizontaldistanceslbr eachof the initial angles.E,rnploya
2.11The lbllowing paramctricequllirrrrsgenerrlc-l hclix
legenclto di.stinguish among the dill-crentcases.and scale
thatcontriicts r'xponentially
as it cvolvcs
thc plot so that thc minirnumheightis zero usingthe azis
.r:e ol'sinI commancl.
\'=c CosI 2.17 The lcmperature dcpendence ol'chcmicalreactionscan
bc ctrrnprrtetl wilh theArrhaniu.tt'tlutrtittn;
ffi=
z\4+ "L
<, lh
,jF-\ :
x
z,_! u=4
zt + zl F+ 3$8
3,I M-FITES 43
3. I M-FIEs
The most common way to operateMATLAB is by enteringcommandsone at a time in the
command window. M-files provide an alternative way of performing operationsthat
greatly expand MATLAB's problem-solvingcapabilities.An M-file containsa seriesof
statementsthat can be run all at once.Note that the nomenclature"M-flle" comesliom the
fact that suchfiles are storedwith a .m extension.M-files comein lwo flavors:scrintfiles
and functionfiles.
3.l. t ScriptFiles
A scriptfile is merely a seriesof MMLAB comnrandsthat are savedon a file. They are
useful for retaininga seriesof commandsthat you want to executeon more than one occa-
sion.The scriptcan be executedby typing the file name in the commandwindow or by
invokingthe nrenuselections in the edit window: Debug,Run.
EXAMPTE
3.I S c r i p tF i l e
50.6175
just as if you had typedeachof its linesin the comntandwinclow.
Thus,the scriptexecutes
ffi L <,
- [h
---_ x eJ 5
zf Lt.t --At ^l
5[ st zJ lj€-
-l
zl'+
-{
zf x+ 8,
Exploring the Variety of Random
Documents with Different Content
peoples of the five continents, and is still retained in some parts of
Africa and elsewhere. In Holstein, Germany, it prevailed in all its
purity, according to Ploss, till the end of the fifteenth century. Nor
would it be doing facts great violence to class our frequent money-
marriages under this head.
There are two grades of the custom of Purchase. In the first the
girl has no choice whatever, but is sold by her father for so many
cows or camels, in some cases to the highest bidder. Among the
Turcomans a wife may be purchased for five camels if she be a girl,
or for fifty if a widow; whereas among the Tunguse a girl costs one
to twenty reindeer, while widows are considerably cheaper. In the
second class of cases the purchased girl is allowed a certain degree
of liberty of choice, as we shall see directly, under the head of
Individual Preference.
(3) Service.—On the custom of securing a wife by means of
services rendered her parents, Mr. Spencer remarks: “The practice
which Hebrew tradition acquaints us with in the case of Jacob,
proves to be a widely-diffused practice. It is general with the Bhils,
Ghonds, and Hill tribes of Nepaul; it obtained in Java before
Mahometanism was introduced; it was common in ancient Peru and
Central America; and among sundry existing American races it still
occurs. Obviously, a wife long laboured for is likely to be more
valued than one stolen or bought. Obviously, too, the period of
service, during which the betrothed girl is looked upon as a future
spouse, affords room for the growth of some feeling higher than the
merely instinctive—initiates something approaching to the courtship
and engagement of civilised peoples.”
INDIVIDUAL PREFERENCE
All the cases thus far referred to relate to what might be called
indirect or mediate courtship. When a girl is captured and knocked
on the head she can hardly be said to be courted and consulted as
to her wishes; and the man too, in such cases, owing to the dangers
of the sport, is apt to pay no great attention to a woman’s looks and
accomplishments, but to bag the first one that comes along. In
courtship by Purchase, again, the girl is rarely consulted as to her
own preferences, the addresses being paid to the father, who
invariably selects the wealthiest of the suitors, and only in rare cases
allows the daughter a choice, as among the Kaffirs if the suitors
happen to be equally well off. And thirdly, in courtship by Service,
the suitor’s work is not done to please the daughter, but to
recompense the parents for losing her.
Yet there appear to be some instances of real courtship, in the
modern sense of the word, among the lower races, where the lovers
pay their addresses directly to the girl and she chooses or rejects at
will. Thus, among the Orang-Sakai, on the Malayan peninsula, the
following custom prevails, as described by Ploss: “On the wedding-
day, the bride, in presence of her relatives, and those of her lover,
and many other witnesses, is obliged to run into the forest. After a
fixed interval the bridegroom follows and seeks to catch her. If he
succeeds in capturing the bride she becomes his wife, otherwise he
is compelled to renounce her for ever. If therefore a girl dislikes her
suitor, she can easily escape from him and hide in the forest until the
time allowed for his pursuit has expired.”
Darwin remarks, in trying to prove the existence of Sexual
Selection among the lower races, that “in utterly barbarous tribes
the women have more power in choosing, rejecting, and tempting
their lovers, or of afterwards changing their husbands, than might
have been expected;” and he cites the following cases, among
others: “Amongst the Abipones, a man on choosing a wife, bargains
with the parents about the price. But ‘it frequently happens that the
girl rescinds what has been agreed upon between the parents and
the bridegroom, obstinately rejecting the very mention of marriage.’
She often runs away, hides herself, and thus eludes the bridegroom.
Captain Musters, who lived with the Patagonians, says that their
marriages are always settled by inclination; ‘if the parents make a
match contrary to the daughter’s will, she refuses, and is never
compelled to comply.’ In Tierra del Fuego a young man first obtains
the consent of the parents by doing them some service, and then he
attempts to carry off the girl; ‘but if she is unwilling, she hides
herself in the woods until her admirer is heartily tired of looking for
her, and gives up the pursuit; but this seldom happens.’”
PRIMITIVE COYNESS
HISTORY OF LOVE
It would be a profitless task to hunt for the first traces of the
various elements of Love in the records of all the nations of
antiquity; for we meet almost everywhere with the same old story of
Romantic Love impeded in its growth or its very existence by the
degraded position of women, and by the absence of opportunities
for courtship, and for free matrimonial choice. A few remarks,
however, must be made concerning Love among the ancient
Egyptians, Hebrews, Greeks, Romans, and our Aryan kinsfolk in
India, before passing on to Mediæval and Modern Love.
LOVE IN EGYPT
Dr. Georg Ebers, the Leipzig professor, and author of the popular
series of historic Egyptian novels, remarks that “if it is true that a
nation’s degree of culture can be estimated by the more or less
favourable position accorded its women, then Egyptian culture ranks
above that of all other ancient peoples.”
The women of ancient Egypt were not kept in seclusion like those
of Greece. They did their own marketing, and had other domestic
and public liberties and privileges which astonished the Greek
historian Herodotus, who also mentions that although polygamy was
tolerated among them, monogamy was the rule. Inasmuch as the
Egyptians had an advanced culture, invented many arts, promoted
the sciences, and were industrial rather than militant in their
occupations, it is possible that several of the more refined elements
of Romantic Love may have existed among them; for just as we
have seen that some animals have higher notions of love, conjugal
and romantic, than some savages, although the latter represent a
later stage of evolution, so it seems probable that among the nations
of antiquity Love did not progress steadily, year by year; but that
some nations had more and some less of it; while the acquisitions of
one period may have been lost in evil and corrupt times following, as
was certainly the case in India.
Since we have no such extensive literature of Egypt as we have of
the Greeks, Romans, and Hebrews, it is not easy to arrive at definite
conclusions. But the Egyptian custom of forming “trial marriages” for
one year, and the ease with which a husband could divorce and
expel his wife by simply pronouncing three words in her presence do
not harmonise with our modern notions of Love. How scornfully a
modern Romeo would reject the very notion of such a trial-marriage!
for does he not feel absolutely certain that his Love is eternal and
unalterable?
The institution of trial-marriages seems to point to the conclusion
that the Egyptians, like the Greeks, looked upon marriage primarily
as a means of augmenting the family and the state, and not as a
union of loving souls—children or no children—which is the modern
ideal.
Professor Ebers of course has a right to make use of a poetic
license in painting the Love affairs of his Egyptian heroes and
heroines in modern colours, as Shakspere does in Antony and
Cleopatra. At the same time it would give an added flavour to
historic romances if their pictures of domestic and public life were
characterised by emotional realism as well as by general antiquarian
accuracy. The elaborate analysis of Love, for the first time attempted
in the present monograph, should facilitate this task for novelists.
GREEK LOVE
The Greeks, too, were Aryans, and they were the most refined
and æsthetic nation of antiquity; yet we look in vain in their
literature for delineations of that Romantic Love which, according to
our notions, ought to accompany so high a degree of culture.
FAMILY AFFECTIONS
NO LOVE-STORIES
But Mr. Lecky, ignoring, like most writers, the enormous difference
between conjugal and romantic love, forgets to notice the absolute
silence of Greek literature on the subject of pre-matrimonial
infatuation. Not one of the Greek tragedies is a “love-drama”;
romantic love does not appear even in the writings of Euripides, who
has so much to say about women, and who named most of his plays
after his heroines. Had Love been known to Sophokles and
Euripides, as it was known to Shakspere and Goethe, we should no
doubt have a Greek Romeo and Juliet and a Greek Faust. For
although there were certain limitations as to the scope and the
dramatis personæ of a Greek play, there was nothing whatever to
exclude a love-story. And when we consider how the sentiment of
Love colours all modern literature; how almost impossible it is for a
play or a novel to succeed unless it embodies a love-story: the
absolute ignoring of this passion in Greek literature forces on us the
inevitable conclusion that Romantic Love was unknown to them, or
only so faintly developed as to excite no interest whatever.
And this conclusion harmonises with the dictum of the best Greek
scholars. It is true that Becker, in his Charikles, referring to the
frequency with which the comedians introduce a youth desperately
enamoured of a girl, faintly objects to the statement that “There is
no instance of an Athenian falling in love with a free-born woman,
and marrying her from violent passion,”—made by Müller in his
famous work on the Dorians. But he makes the fatal admission that
“Sensuality was the soil from which such passion sprang, and none
other than a sensual love was acknowledged between man and
wife.” No one, of course, would deny that sensual passion prevailed
in Athens; but sensuality is the very antipode of Romantic Love.
WOMAN’S POSITION
In such an arid, rocky soil Love of course could not grow or even
germinate. Still more fatal to the romantic passion, however, was the
absolute seclusion of the sexes, precluding all possibility of courtship
and free choice among the young. Greek women were not allowed
to enjoy the society of men, nor to attend “those public spectacles
which were the chief means of Athenian culture,” and which would
have afforded the young folks an opportunity of seeing and falling in
love with one another. The wife was not even permitted to eat with
her husband if male visitors were present, but had to retire to her
private apartments, so absurd was the jealousy of the men. “The
maidens lived in the greatest seclusion till their marriage, and, so to
speak, regularly under lock and key,” which had the “effect of
rendering the girls excessively bashful, and even prudish,” and so
stupid, in all probability, that no wonder the men considered
marriage a punishment, and sought entertainment with the
educated Hetæræ—as to-day in France. Even young married women
were obliged to have a chaperon. “No respectable lady thought of
going out without a female slave.” “Even the married woman shrank
back and blushed if she chanced to be seen at the window by a
man.”
PLATO ON COURTSHIP
Marriages in Greece were often arranged for girls while they were
mere children, of course without any reference to their choice, since
they were looked upon as the property of the father, who could
dispose of them at his pleasure. Besides these early betrothals there
was an obstacle to free choice in the Athenian law which forbade a
citizen under very severe penalties to marry a foreigner. And again,
“In the case of a father dying intestate, and without male children,
his heiress had no choice in marriage; she was compelled by law to
marry her nearest kinsman, not in the ascending line.... Where there
were several co-heiresses, they were respectively married to their
kinsmen, the nearest having the first choice”—a law resembling one
in the Jewish code, and exemplified by Ruth, as pointed out in
Smith’s Dictionary.
How Sexual Selection was rendered impracticable in Greece is
further shown in the following citations from Becker: “The choice of
the bride seldom depended on previous, or at least on intimate
acquaintance. More attention was generally paid to the position of a
damsel’s family, and the amount of her dowry, than to her personal
qualities.” "It was usual for a father to choose for his son a wife, and
one perhaps whom the bridegroom had never seen." “Widows
frequently married again; this was often in compliance with the
testamentary dispositions of their husbands, as little regard being
paid to their wishes as in the case of girls.”
Thus we see that three causes combined to prevent the growth of
Romantic Love in Greece—the degraded position of women, the
absence of direct Courtship, and the impossibility of exercising
Individual Preference.
THE HETÆRÆ
PLATONIC LOVE