Example: quiz answers

INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS

INTRODUCTION TO MATLAB FORENGINEERING STUDENTSD avid HoucqueNorthwestern University(version , August 2005)Contents1 Tutorial lessons .. features.. minimum MATLAB session.. Starting MATLAB .. Using MATLAB as a calculator .. Quitting MATLAB .. started.. Creating MATLAB variables .. Overwriting variable .. Error messages .. Making corrections .. Controlling the hierarchy of operations or precedence .. Controlling the appearance of floating point number .. Managing the workspace .. Keeping track of your work session .. Entering multiple statements per line .. Miscellaneous commands .. Getting help .. 112 Tutorial lessons functions.. Examples .. plotting.. overview .. Creating simple plots .. Adding titles, axis labels, and annotations .. Multiple data sets in one plot .. Specifying line styles and colors .. generation.. Entering a vector.

4 Introduction to programming in MATLAB 35 ... \Introduction to MATLAB for Engineering Students" is a document for an introductory ... FORTRAN) for solving technical problems. MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. The software package

Tags:

  Introduction, Programming, Matlab, Fortran, Introduction to programming, Introduction to matlab

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS

1 INTRODUCTION TO MATLAB FORENGINEERING STUDENTSD avid HoucqueNorthwestern University(version , August 2005)Contents1 Tutorial lessons .. features.. minimum MATLAB session.. Starting MATLAB .. Using MATLAB as a calculator .. Quitting MATLAB .. started.. Creating MATLAB variables .. Overwriting variable .. Error messages .. Making corrections .. Controlling the hierarchy of operations or precedence .. Controlling the appearance of floating point number .. Managing the workspace .. Keeping track of your work session .. Entering multiple statements per line .. Miscellaneous commands .. Getting help .. 112 Tutorial lessons functions.. Examples .. plotting.. overview .. Creating simple plots .. Adding titles, axis labels, and annotations .. Multiple data sets in one plot .. Specifying line styles and colors .. generation.. Entering a vector.

2 Entering a matrix .. Matrix indexing .. Colon operator .. Linear spacing .. Colon operator in a matrix .. Creating a sub-matrix .. Deleting row or column .. Dimension .. Continuation .. Transposing a matrix .. Concatenating matrices .. Matrix generators .. Special matrices .. 293 Array operations and Linear operations.. Matrix arithmetic operations .. Array arithmetic operations .. Solving linear equations .. Matrix inverse .. Matrix functions .. 344 INTRODUCTION to programming in INTRODUCTION .. M-File Scripts .. Examples .. Script side-effects .. M-File functions .. Anatomy of a M-File function .. Input and output arguments .. Input to a script file .. Output commands .. 425 Control flow and .. flow.. The structure .. Relational and logical operators .. The loop .. The loop .. Other flow structures.

3 Operator precedence .. output to a file.. 486 Debugging .. process.. Preparing for debugging .. Setting breakpoints .. Running with breakpoints .. Examining values .. Correcting and ending debugging .. Ending debugging .. Correcting an M-file .. 51 ASummary of commands53 BRelease notes for Release 14 with Service Pack of changes.. changes.. details.. 60 CMain characteristics of .. 63ivList of Basic arithmetic operators .. Hierarchy of arithmetic operations .. Elementary functions .. Predefined constant values .. Attributes forplot.. Elementary matrices .. Special matrices .. Array operators .. Summary of matrix and array operations .. Matrix functions .. Anatomy of a M-File function .. Difference between scripts and functions .. Example of input and output arguments .. Relational and logical operators .. Operator precedence.

4 Operators and special characters.. operators.. and logical operators.. workspace and file commands.. variables and math constants.. matrices and arrays.. and Matrices: Basic information.. and Matrices: operations and manipulation.. and Matrices: matrix analysis and linear equations.. 57viList of The graphical interface to the MATLAB workspace .. Plot for the vectors x and y .. Plot of the Sine function .. Typical example of multiple plots .. 17viiPreface INTRODUCTION to MATLAB for ENGINEERING STUDENTS is a document for an introductorycourse in MATLABR 1and technical computing. It is used for freshmen classes at North-western University. This document is not a comprehensive INTRODUCTION or a reference man-ual. Instead, it focuses on the specific features of MATLAB that are useful for engineeringclasses. The lab sessions are used with one main goal: to allow STUDENTS to become familiarwith computer software ( , MATLAB ) to solve application problems.

5 We assume that thestudents have no prior experience with availability of technical computing environment such as MATLAB is now reshapingthe role and applications of computer laboratory projects to involve STUDENTS in more intenseproblem-solving experience. This availability also provides an opportunity to easily conductnumerical experiments and to tackle realistic and more complicated , the manual is divided into computer laboratory sessions (labs). The labdocument is designed to be used by the STUDENTS while working at the computer. Theemphasis here is learning by doing . This quiz-like session is supposed to be fully completedin 50 minutes in seven lab sessions include not only the basic concepts of MATLAB , but also an in-troduction to scientific computing, in which they will be useful for the upcoming engineeringcourses. In addition, ENGINEERING STUDENTS will see MATLAB in their other end of this document contains two useful sections: a Glossary which contains thebrief summary of the commands and built-in functions as well as a collection of release release notes, which include several new features of the Release 14 with Service Pack2, well known as R14SP2, can also be found in Appendix.

6 All of the MATLAB commandshave been tested to take advantage with new features of the current version of MATLAB available here at Northwestern (R14SP2). Although, most of the examples and exercises stillwork with previous releases as manual reflects the ongoing effort of the McCormick School of ENGINEERING andApplied Science leading by Dean Stephen Carr to institute a significant technical computingin the ENGINEERING FirstR 2courses taught at Northwestern , the STUDENTS - ENGINEERING Analysis (EA) Section - deserve my special grati-tude. They were very active participants in HoucqueEvanston, IllinoisAugust 20051 MATLABR is a registered trademark of MathWorks, FirstR is a registered trademark of McCormickSchool of ENGINEERING and Applied Science (Northwestern University)viiiAcknowledgementsI would like to thank Dean Stephen Carr for his constant support. I am grateful to a numberof people who offered helpful advice and comments. I want to thank the EA1 instructors(Fall Quarter 2004), in particular Randy Freeman, Jorge Nocedal, and Allen Taflove fortheir helpful reviews on some specific parts of the document.

7 I also want to thank MalcombMacIver, EA3 Honors instructor (Spring 2005) for helping me to better understand theanimationof system dynamics using MATLAB . I am particularly indebted to the manystudents (340 or so) who have used these materials, and have communicated their commentsand suggestions. Finally, I want to thank IT personnel for helping setting up the classes andother computer related work: Rebecca Swierz, Jesse Becker, Rick Mazec, Alan Wolff, KenKalan, Mike Vilches, and Daniel the authorDavid Houcque has more than 25 years experience in the modeling and simulation of struc-tures and solid continua including 14 years in industry. In industry, he has been working asR&D engineer in the fields of nuclear ENGINEERING , oil rig platform offshore design, oil reser-voir ENGINEERING , and steel industry. All of these include working in different internationalenvironments: Germany, France, Norway, and United Arab Emirates. Among other things,he has a combined background experience: scientific computing and ENGINEERING earned his academic degrees from Europe and the United at Northwestern University, he is working under the supervision of Professor BrianMoran, a world-renowned expert in fracture mechanics, to investigate the integrity assess-ment of the aging highway bridges under severe operating conditions and 1 Tutorial lessons tutorials are independent of the rest of the document.

8 The primarily objective is to helpyou learnquicklythe first steps. The emphasis here is learning by doing . Therefore, thebest way to learn is by trying it yourself. Working through the examples will give you a feelfor the way that MATLAB operates. In this INTRODUCTION we will describe how MATLAB handles simple numerical expressions and mathematical name MATLAB stands for MATrix LABoratory. MATLAB was written originallyto provide easy access to matrix software developed by the LINPACK (linear system package)and EISPACK (Eigen system package) [1] is a high-performance language for technical computing. It integratescomputation,visualization, andprogrammingenvironment. Furthermore, MATLAB is amodern programming language environment: it has sophisticateddata structures, containsbuilt-in editing anddebugging tools, and supportsobject-oriented programming . These factorsmake MATLAB an excellent tool for teaching and has many advantages compared to conventional computer languages ( ,C, fortran ) for solving technical problems.

9 MATLAB is an interactive system whosebasic data element is anarraythat does not require dimensioning. The software packagehas been commercially available since 1984 and is now considered as a standard tool at mostuniversities and industries has powerfulbuilt-inroutines that enable a very wide variety of computations. Italso has easy to use graphics commands that make the visualization of results immediatelyavailable. Specific applications are collected in packages referred to astoolbox. There aretoolboxes for signal processing, symbolic computation, control theory, simulation, optimiza-tion, and several other fields of applied science and addition to the MATLAB documentation which is mostly available on-line, we would1recommend the following books: [2], [3], [4], [5], [6], [7], [8], and [9]. They are excellent intheir specific featuresAs we mentioned earlier, the followingtutoriallessons are designed to get you startedquickly in MATLAB . The lessons are intended to make you familiar with the basics ofMATLAB.

10 We urge you to complete theexercisesgiven at the end of each minimum MATLAB sessionThe goal of thisminimumsession (also calledstartingandexitingsessions) is to learn thefirst steps: How to log on Invoke MATLAB Do a few simple calculations How to quit Starting MATLABA fter logging into your account, you can enter MATLAB by double-clicking on the MATLAB shortcuticon( MATLAB ) on your Windows desktop. When you start MATLAB , aspecial window called the MATLAB desktop appears. The desktop is a window that containsotherwindows. The major tools within or accessible from the desktop are: TheCommand Window TheCommand History TheWorkspace TheCurrent Directory TheHelp Browser TheStartbutton2 Figure : The graphical interface to the MATLAB workspace3 When MATLAB is started for the first time, the screen looks like the one that shownin the Figure This illustration also shows the default configuration of the MATLAB desktop. You can customize the arrangement of tools and documents to suit your , we are interested in doing some simple calculations.


Related search queries