Applied Numerical Methods Using MATLAB. Won Y. Yang

Чтение книги онлайн.

Читать онлайн книгу Applied Numerical Methods Using MATLAB - Won Y. Yang страница 12

Applied Numerical Methods Using MATLAB - Won Y. Yang

Скачать книгу

Y. Yang et al.

      March 2020

      The knowledge in this book is derived from the work of many eminent scientists, scholars, researchers, and MATLAB developers, all of whom we thank. We thank our colleagues, students, relatives, and friends for their support and encouragement. We thank the reviewers, whose comments were so helpful in tuning this book. We gratefully acknowledge the editorial, Brett Kurzman and production staff of John Wiley & Sons, Inc. including Project Editor Antony Sami and Production Editor Gayathree Sekar for their kind, efficient, and encouraging guide.

      Don't forget to visit the companion website for this book:

      www.wiley.com/go/yang/appliednumericalmethods

      Scan this QR code to visit the companion website:

      There you will find valuable material designed to enhance your learning, including:

       Learning Outcomes for all chapters

       Exercises for all chapters

       References for all chapters

       Further reading for all chapters

       Figures for chapters 16, 22 and 30

      Chapter Outline

        1.1 Basic Operations of MATLAB 1.1.1 Input/Output of Data from MATLAB Command Window 1.1.2 Input/Output of Data Through Files 1.1.3 Input/Output of Data Using Keyboard 1.1.4 Two‐Dimensional (2D) Graphic Input/Output 1.1.5 Three Dimensional (3D) Graphic Output 1.1.6 Mathematical Functions 1.1.7 Operations on Vectors and Matrices 1.1.8 Random Number Generators 1.1.9 Flow Control

        1.2 Computer Errors vs. Human Mistakes 1.2.1 IEEE 64‐bit Floating‐Point Number Representation 1.2.2 Various Kinds of Computing Errors 1.2.3 Absolute/Relative Computing Errors 1.2.4 Error Propagation 1.2.5 Tips for Avoiding Large Errors

        1.3 Toward Good Program 1.3.1 Nested Computing for Computational Efficiency 1.3.2 Vector Operation vs. Loop Iteration 1.3.3 Iterative Routine vs. Recursive Routine 1.3.4 To Avoid Runtime Error 1.3.5 Parameter Sharing via GLOBAL Variables 1.3.6 Parameter Passing Through VARARGIN 1.3.7 Adaptive Input Argument List Problems

      Once you start the MATLAB program, a Command window will open with the MATLAB prompt ≫. On the command line, you can type MATLAB commands, functions together with their input/output arguments, the names of script files containing a block of statements to be executed at a time or functions defined by users. The MATLAB program files must have the extension name ***.m to be executed in the MATLAB environment. If you want to create a new M‐file or edit an existing file, you click File/New/M‐file or File/Open in the top left corner of the main menu, find/select/load the file by double‐clicking it, and then begin editing it in the Editor window. If the path of the file you want to run is not listed in the MATLAB search path, the file name will not be recognized by MATLAB. In such cases, you need to add the path to the MATLAB‐path list by clicking the menu ‘Set_Path’ in the Command window, clicking the ‘Add_Folder’ button, browsing/clicking the folder name and finally clicking the SAVE button and the Close button. The lookfor command is available to help you find the MATLAB commands/functions that are related with a job you want to be done. The help command helps you know the usage of a particular command/function. You may type directly in the Command window

       >lookfor repeat or >help for

      to find the MATLAB commands in connection with ‘repeat’ or to find information about the ‘for loop’

      One of the many features of MATLAB is that it enables us to deal with the vectors/matrices in the same way as scalars. For instance, to input the matrices/vectors,

      type the following statements in the MATLAB Command window:

       >A=[1 2 3;4 5 6] A= 1 2 3 4 5 6 >B=[3;-2;1]; %put the semicolon at the end of the statement to suppress the result printout onto the screen >C=[1 -2 3 -4]

      At the end of the statement, press <Enter> key if you want to check the result

Скачать книгу