appl matlab

Download Appl Matlab

Post on 04-Dec-2014

122 views

Category:

Documents

7 download

Embed Size (px)

TRANSCRIPT

CONTENTSAbout the Aufhor Prefoce xiii xvii iv

Guided Tour

PanrOur Modeling, Computers, ond Error Anolysis Il. I Motivofion I 1.2 Port Orgonizotion 2

CHAPTER IMothemqticol Modeling, Numericol Methods, ond Problem Solving 4 I .l A Simple M o t h e m o t i cM o lo d e l 5 1.2 Conservotion Lowsin Engineering ond Science 12 1.3 Numericol Methods Covered in ThisBook l3 P r o b l e m s1 7

CHAPTER 2MATLAB Fundomeniqls 2.1 2.2 2.3 2.4 2.5 2.6 2.7^ l l

20

TheMATIABEnvironmenl21 Assignment 22 Mothemoticol Operotions 27 U s eo f B u i l t l n Functions 30 Groohics 33 OtherResources36 CoseStudy: Explorotory DotoAnolysis 37

rroblems JY

CHAPTER 3Progromming with MATTAB 42 3.1 M-Files 43 3.2 InputOutput 47

vl

CONTENTSdr o g r o m m i n g 3 . 3 S h u c t u r eP 5l 3.4 Nesting ond Indentotion 63 gunction 3 . 5 P o s s i nF to s M-Files66 3.6 CoseStudy: Bungee Velocity 71 Jumper Problems 75

4 CHAPTERRoundoff qnd Truncotion Errors 79 4.1 ErrorsB0 4.2 Roundoff Errors 84 4.3 Truncotion Errors 92 ,l03 4 . 4 T o t oN l umerico E l rror , o d e lE r r o r so 4.5 Blunders M , n d D o t oU n c e r t o i n t y1 0 8 ,l09 Problems

.|11 PnnrTwo Roots ondOptimizotion2.1 Overview tll 2.2 Port Orgonizotion I 12

CHAPTER 5Roois: Brocketing Methods I l4 in Engineerin 5.1 Roots og ndScience I l5 5 . 2 G r o p h i c oM l ethods I l6 ge t h o d s 5.3 Brocketin M o 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 Folse Position128 5.6 CoseStudv: Greenhouse Gosesond Roinwoter 132 ,l35 Problems

CHAPTER 6Roots: Open Methods | 39 6.1 Simple F i x e d - P o iln te i rotion 140 6 . 2 N e w t o n - R o p h s o1 n4 4 6 . 3 S e c o nM t ethods 149 6.4 MATLAB Function f :z e r o r 5 1 6 . 5 P o l v n o m l o l s1 5 4 : i p eF r i c t i o n 1 5 7 6 . 6 C o s eS t u d yP Problems 162

CONTENTS

Yrt

7 CHAPTEROptimizofion 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 i1 o7 n0 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 i1 o7 n9 Eln e r g y l 8 l m ndMinimum Potentio 7 . 4 C o s eS t u d yE : q u i l i b r i uo P r o b l e m s1 8 3

,|89 PrnrTxnrr Lineor Systems3.1 Overview 189 3.2 Port Orgonizotion l9l

CHAPTER 8Lineqr Algebroic Equofions ond Motrices | 93 8.1 MotrixAlgebroOverview 194 Algebroic Equotions with MATLAB 203 Lineor 8.2 Solving in Circuits 205 Currents ond Voltoges 8.3 CoseStudy: Problems 209

9 CHAPTERGouss Eliminotion 212 of Equotio sn 2 1 3 9.1 Solving SmolN l umbers E l i m i n o t i o n2 1 8 9 . 2 N o i v eG o u s s 9.3 Pivoting225 9.4 Tridiogono Sly s t e m s2 2 7 9.5 CoseStudy: Model of o HeotedRod 229 Problems 233

IO CHAPTER[U Foctorizotion 236 237 l0.l Overview of lU Foctorizotion Eliminotio 238 10.2 Gouss on s lU Foctorizotion 244 1 0 . 3 C h o l e s kF yoctorizotion 'l0.4 Left Division 246 MATLAB Problems 247

vIt!

CONIENTS

CHAPTER IIMotrix lnverse ond Condition 249 1 i .l TheMotrix lnverse 249 I I .2 ErrorAnolysis ond System Condition 253 I 1 . 3 C o s eS t u d yI A i r P o l l u t i o n2 5 8 :n d o o r Problems 261

CHAPTER I2Iterotive Methods 264 l2.l Lineor 264 Systems: Gouss-Seidel ,l2.2 N o n l i n e oS r y s t e m s2 7 0 1 2 . 3 C o s eS t u d vC : h e m i c oR l eoctions 277 P r o b l e m s2 7 9

PtrnrFoun Curve Fitting 2814.1 Overview 281 4.2 Port Orgonizotion 283

CHAPTER I3Lineor Regression 284 R 13.I Stotistic se v i e w 2 8 6 es gression 1 3 . 2 L i n e oL r e o s t - S q u oR re 292 ,l3.3 Lineorizotion f N o n l i n e oR s0 0 r e l o t i o n s h i p3 1 3 . 4 C o m p u t eA r 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 : nzyme K i n e t i c s3 0 7rroDtems 5 | z^ l l

CHAPTER I4Generol 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 n 3 16 14.2 Multiple L i n e oR r egression 32O 1 4 . 3 G e n e r oL r e o sS l i n e oL t ouores322 14.4 QR Foctorizotion ond the Bockslosh Ooerotor 325 1 4 . 5 N o n l i n e oR e g r e s s i o n 3 2 6 r 1 4 . 6 C o s eS l u d y F : itting S i n u s o i d s3 2 8h

rrontcms

l l

.1.1 /

CONIENIS

'I 5.'l lntroduction to Interpotofion336 I5.2 NewronInterpoloring polynomiol 33g polynomiol j: .j tosron9etnrerpoloring 347 rJ.4 tnverse tnterpolotion350 I J.J txkopolotion ondOscillotions 351 Problems 355

t6 cHAPTERSplines ond piecewise Inferpofofion I 6 . I l n k o d u c t i otn o Splines 359 l o . z L i n e aS r p l i n e s3 6 1 16.3 Quodroiic Splines365 1 6 . 4 C u b i cS p l i n e s 3 6 8 359

374 i 6.6 Multidimensionol Interpolotion 37g l6 Z CoseStudy: HeotTronsfer 3g2 rrobtems 386

Inrerpotorion inMATLAB l9: liTewise

PnnrFvr Infegrotion ond Differentiotion 3g95.1 Overview 3g9 5.2 Port Orgonizotion 39O !H,\PTER| 7Numericof fnfegrofion Formutos Sg2 'l Z.J lnhoduction ond Bocrground 393 I7.2 Newton-Cotes Formutos 396 17.3 TheTropezoidol Rule 39g 17.4 Simpson, su l e s 4 0 5 R 17.5 Higher-Order Newfon_Cotes Formulos 4j j l7 6 lntegration with Unequol Segments 412 17.7 OpenMerhods 416 I7 8 Muh,ple I n t e g r o l s4 j 6 Compuring Work wirh Numericol lnregrorion 4j9 ;lJ;:r";udy:t It I

!

i{.

Numericof Integrotion of Functions 'l 8.I Introducfion 426 18.2 RomberI qn i e q r o t i o n4 2 7

CONTENTS18.3 Gouss Q u o d r o t u r e4 3 2 I8.4 Adoptive Q u o d r o t u r e4 3 9 I8.5 CoseStudy:Root-Meon-Squore Current 440 Problems 444

CHAPTER I9Numericql Differentiqtion 19.I 19.2 I9.3 ,l9.4 ,l9.5 448 Inhoduction ond Bockground 449 High-Accurocy Differentiotion Formulos 452 Richordso nx t r o p o l o t i o n E 455 Derivotives of Unequolly SpocedDoto 457 Derivotives ond lntegrols for Dofo with Errors 458 19.6 Portiol Derivotives 459 I9.2 Numericol Differentiotion with MATLAB 460 I 9 . 8 C o s eS t u d yV : i s u o l i z i nF gi e l d s 4 6 5 Problems 467

Pnnr5x

Ordinory Differentiol Equotions 4736.1 Overview 473 6.2 Porl Orgonizofion 477

CHAPTER 20Initiol-Volue Problems 479 20.I Overview 481 20.2 EuleisMethod 481 20.3 lmprovemenls of Euler's Method 487 20.4 Runge-Kutfo Methods 493 20.5 Systems of Equotions 498 20.6 CoseStudy:Predotory-Prey Modelsond Choos 50A Problems 509

CHAPTER 2IAdopfive Merhods ond Stiff Systems 514 21 .'l AdoptiveRunge-Kutto Methods 514 2l .2 Multistep Methods 521 2l .3 Stiffness525 2l .4 MATLAB Applicotion :u n g e J B e u m p ew r i t hC o r d 5 3 1 2l .5 CoseStudy: Pliny's lntermittent Fountoin 532 r r o D l e m s3 J /

CONTENTS

xl

22 CHAPTERBoundory-Volue Problems 540 22.1 lntrodvction ond Bockground 541 Method 545 22.2 lhe Shooting 22.3 Finite-Difference Methods 552 P r o b l e m s5 5 9

APPENDIX A: EIGENVALUES 565 FUNCTIONS 576 APPENDIX B: MATLAB BUILT-IN APPENDIX : MATIAB M-FltE FUNCTIONS 578 BIBLIOGRAPHY579 rNDEX 580

Modqling,CoTpute''i ,qnd Erior Anolysis

t.t

MoTtvATtoNWhat are numericalmethodsand why shouldyou stridythem? problemsare formulatedso are techniques by which mathematical Numericalmethods Because digital computers that they can be solved with arithmeticand logical operations. numericalmethodsare sometimes referredto as comexcel at perform.ing suchoperations. puter mathematics. se.-In the pre-computerera, the time and drudgeryof implementingsuchcalculations 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 founand science, dationsin the other areasof mathematics of we should also have a fundamentalunderstanding numerical methods.In particular,we should have a solid appreciation of both their capabilitiesand their limitations. Beyond contributing to your overall education. .thog T9 several additibnat reasons why you shoutO .",,,,rr,,,r,,,r,,,,,, study numerical methods: 1. Numerical methods greatly expqld the types of , problems you can address. They are capableof nonlinearihandlinglarge systems of equations. , , d.l, and complicated geometriesthat are not uncommon in engineeringand scienceand that are often impossible to solve analyticallywith stanyour dard calculus. As such"they greatlyenhance problem-solving skills. 2. Numorical methods allow you to use "canned" so-ftware with insight. During your career,you will q*"

AND ERROR ANALYSIS I MODELING, COMPUTERS, PARTprepackaged computerproto use commercially available invariablyhave occasion grarnsthat involve numericalmethods. The intelligentuseof theseprogramsis greatly of the basic theory underlyingthe methods.In the abenhanced by an understanding you will be left to treat suchpackages as "black boxes" senceof suchunderstanding, with little critical insightinto their inner workingsor the validity of the resultsthey produce. Many problemscannotbe approached using cannedprograms.If you are conversant with numerical methods,and are adept at computer programming,you can design expensive your own programs withouthavingto buy or commission to solveproblems software. Because nuNr.rrnerical methodsare an efficient vehiclefbr learningto usecomputers. they areidealtbr mericalmethods ale expressly designed for computerimplementation, implement powers and limitations.When you successfully illustratingthe conrputer's numericalmethodson a computer,and then apply them to solve otherwiseintractable problenrs, you will be plovided with a dramaticdernonstration of how computerscan At the sarne serveyour professional development. lime, you rvilI alsolearnto acknowledge and control the errors of approximationthat are part and parcel of large-scale numericalcalculations. Numericalmetho