crc series in computational mechanics and applied …

6
CRC Series in COMPUTATIONAL MECHANICS and APPLIED ANALYSIS NUMERICAL AND ANALYTICAL METHODS WITH MATLAB® WILLIAM BOBER CHI-TAY TSAI OREN MASORY C\ CRC Press >V J Taylor & Francis Group Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Group, an informa business

Upload: others

Post on 29-May-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CRC Series in COMPUTATIONAL MECHANICS and APPLIED …

CRC Series in COMPUTATIONAL MECHANICS and APPLIED ANALYSIS

NUMERICAL AND ANALYTICAL

METHODS WITH MATLAB®

WILLIAM BOBER CHI-TAY TSAI

OREN MASORY

C\ CRC Press >V J Taylor & Francis Group

Boca Raton London New York

CRC Press is an imprint of the Taylor & Francis Group, an informa business

Page 2: CRC Series in COMPUTATIONAL MECHANICS and APPLIED …

Contents

Preface xi

Acknowledgments xv

Authors xvii

1 Numerical Modeling for Engineering 1 1.1 Computer Usage in Engineering 1

1.1.1 Importance of the Computer 1 1.1.2 Computer Usage 1

1.2 The Mathematical Model 2 1.3 Computer Programming 2 1.4 Preparing a Computer Program 3 1.5 Recommended Procedures for Writing a Program 3 1.6 Building Blocks in Writing a Program 3

2 MATLAB Fundamentals 5 2.1 Introduction 5

2.1.1 The MATLAB Windows 5 2.2 Constructing a Program in MATLAB 8 2.3 The MATLAB Program 8 2.4 Program Examples 18 2.5 Debugging a Program 26 2.6 3-D and Contour Plots 28 Projects 29 References 44

3 Matrices 45 3.1 Matrix Operations 45 3.2 System of Linear Equations 48

3.2.1 The inv Function 49 3.2.2 The Gauss Elimination Function 49 3.2.3 Examples 50

v

Page 3: CRC Series in COMPUTATIONAL MECHANICS and APPLIED …

vi • Contents

3.3 Gauss Elimination 55 3.4 The Gauss-Jordan Method 61 3.5 Number of Solutions 63 3.6 Inverse Matrix 64 3.7 The Eigenvalue Problem 68 Exercises 72 Projects 72 Reference 76

4 Roots of Algebraic and Transcendental Equations 77 4.1 The Search Method 77 4.2 Bisection Method 77 4.3 Newton-Raphson Method 79 4.4 The fzero Function 80

4.4.1 Example Programs 84 Projects 83 Reference 93

5 Numerical Integration 95 5.1 Numerical Integration and Simpson's Rule 95 5.2 Improper Integrals 98 5.3 MATLAB's Quad Function 100 5.4 MATLAB's DBLQUAD Function 101 Exercises 102 Projects 103

6 Numerical Integration of Ordinary Differential Equations 105 6.1 The Initial Value Problem 105 6.2 The Fourth-Order Runge-Kutta Method 107 6.3 System of Two First-Order Equations 108 6.4 A Single Second-Order Equation 108 6.5 MATLAB's ODE Function 110 6.6 Ordinary Differential Equations That Are Not

Initial Value Problems 112 6.7 Solution of a Tri-Diagonal System of Linear Equations 112 6.8 Difference Formulas 115 6.9 Deflection of a Beam 118 Projects 121

7 Simulink 141 7.1 Introduction 141 7.2 Creating a Model in Simulink 141 7.3 Typical Building Blocks in Constructing a Model 143

Page 4: CRC Series in COMPUTATIONAL MECHANICS and APPLIED …

Contents • vii

7.4 Constructing and Running the Model 146 7.5 Constructing a Subsystem 146 7.6 Using the mux and fen Blocks 146 7.7 The Relay Block 148 7.8 The Switch Block 149 7.9 Trigonometric Function Blocks 150 Projects 152

8 Curve Fitting 155 8.1 Curve-Fitting Objective 155 8.2 Method of Least Squares 155 8.3 Curve Fitting with the Exponential Function 158 8.4 MATLAB's Curve-Fitting Function 160 8.5 Cubic Splines 162 8.6 The Function Interpl for Cubic Spline Curve Fitting 164 8.7 Curve Fitting with Fourier Series 164 Projects 167

9 Optimization 171 9.1 Introduction 171 9.2 Unconstrained Optimization Problems 172 9.3 Method of Steepest Descent 173 9.4 Optimization with Constraints 176 9.5 MATLAB's Optimization Function 178 Exercises 182 Projects 182 Reference 186

10 Partial Differential Equations 187 10.1 The Classification of Partial Differential Equations 187 10.2 Solution by Separation of Variables 188

10.2.1 The Vibrating String 188 10.2.2 Unsteady Heat Transfer I (Bar) 192 10.2.3 Unsteady Heat Transfer II (Cylinder) 199

10.3 Unsteady Heat Transfer in 2-D 206 10.4 Perturbation Theory and Sound Waves 211 10.5 Review of Finite Difference Formulas 217 10.6 Example of Applying Finite Difference Methods to Partial

Differential Equations 217 10.6.1 The Explicit Method 218 10.6.2 The Implicit Method 220

Projects 221

Page 5: CRC Series in COMPUTATIONAL MECHANICS and APPLIED …

viii • Contents

11 Iteration Method 233 11.1 Iteration in Pipe Flow Analysis 233 11.2 The Gauss-Seidel Method 235 11.3 The Hardy-Cross Method 238 Projects 241 References 248

12 Laplace Transforms 249 12.1 Laplace Transform and Inverse Transform 249 12.2 Transforms of Derivatives 256 12.3 Ordinary Differential Equations, Initial Value Problem 257 12.4 A Shifting Theorem 260 12.5 The Unit Step Function 263 12.6 Laplace Transform of the Unit Step Function 264 12.7 Convolution 268 12.8 Laplace Transforms Applied to Partial Differential Equations 271 12.9 Laplace Transforms and Complex Variables 276

12.9.1 Residues and Poles 278 Exercises 281 References 282

13 An Introduction to the Finite Element Method 283 13.1 Finite Element Method for Stress Analysis 283 13.2 Structural Mechanics Plane Stress Analysis 283 13.3 The Shape Function for a Linear Triangle Element 288

13.3.1 3-Node Triangular Element for 2-D Stress Analysis 290 13.3.2 Shape Function in Area Coordinates 291 13.3.3 Finite Element Formulation Using Triangular

Elements 292 13.4 Finite Element Analysis Using MATLAB's PDE Toolbox 299 13.5 Structural Mechanics Plane Strain Analysis 320 13.6 Model Analysis of 2-D Structures 321 13.7 Finite Element Analysis for Heat Transfer 325 Projects 339 References 341

14 Control Systems 343 14.1 Introduction 343 14.2 Representation of Systems in MATLAB 346

14.2.1 Transfer Function Representation 348 14.2.2 Zero-Pole-Gain Format of Transfer Function

Representation 350 14.2.3 State Space Representation 352

Page 6: CRC Series in COMPUTATIONAL MECHANICS and APPLIED …

Contents • ix

14.3 Closed-Loop Systems 355 14.3.1 DC Motor Modeling 355 14.3.2 Block Diagrams 357 14.3.3 MATLAB Tools for Defining the Closed-Loop System....358

14.4 MATLAB Tools for the Performance Analysis of Closed-Loop Systems 361 14.4.1 Root Locus Plots 361 14.4.2 Nyquist Plots 363

14.5 MATLAB's SISOtool 367 14.5.1 Example to Be Used with SISOtool 367 14.5.2 SISOtool Main Features 370 14.5.3 Using SISOtool to Design the Controller for Example

at Beginning of This Section 371 14.6 Application of Simulink in Controls and Dynamic Systems 377

14.6.1 Example of Control of the Fluid Level in Coupled Tanks 377

14.6.2 Design of a Feed-Forward Loop Using Optimality Criteria 385

14.6.3 Active Suspension 391 14.6.4 Sampled Data Control System 394 14.6.5 Implementation of ADC and DAC in Simulink 397

14.7 Simulink's Data Acquisition Toolbox 405 14.7.1 Analog Input 406 14.7.2 Analog Output 407 14.7.3 Digital Input 408 14.7.4 Digital Output 408

Projects 412 Endnotes 417

Appendix A 419

Appendix В 423

Appendix С 429

Index 439