DOC PREVIEW
TAMU MATH 308 - matbasics

This preview shows page 1-2-3-26-27-28 out of 28 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

MATLAB 7.0 BasicsP. HowardSpring 2005Contents1 Introduction 22 Starting MATLAB at Texas A&M University 23 Simple Computations with MATLAB 33.1 Whatyou’relookingat........................................ 33.2 BasicComputations ......................................... 33.2.1 ArrayOperations....................................... 43.3 BasicAlgebra............................................. 43.3.1 SolvingAlgebraicEquationsinMATLAB ......................... 53.3.2 The Subs Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.3.3 Inline Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.4 Basic Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.4.1 Differentiation ........................................ 73.4.2 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.4.3 Limits............................................. 83.4.4 SumsandProducts ..................................... 93.4.5 Taylorseries ......................................... 93.4.6 Maximization and Minimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.5 M-Files ................................................ 103.5.1 ScriptM-Files ........................................ 103.5.2 WorkinginScriptM-files .................................. 113.5.3 FunctionM-files ....................................... 123.5.4 DebuggingM-files ...................................... 133.6 FileManagementfromMATLAB.................................. 133.7 The Command Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.8 TheCommandHistory........................................ 133.9 TheMATLABWorkspace...................................... 134 Plots and Graphs in MATLAB 144.1 Simple x–y Plots ........................................... 144.2 PlottingFunctions .......................................... 154.2.1 Plottingfunctionswiththeplotcommand......................... 154.2.2 Ezplot............................................. 164.3 JuxtaposingOnePlotOnTopofAnother ............................. 174.4 Multiple Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.5 Plotting Functions of Multiple Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.5.1 ContourPlots......................................... 184.6 SavingPlotsasEncapsulatedPostscriptFiles........................... 185 Matrices 1916 Programming in MATLAB 206.1 Overview ............................................... 206.2 Loops ................................................. 206.2.1 TheForLoop......................................... 206.2.2 The While Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.3 Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.3.1 If-ElseStatements ...................................... 216.3.2 SwitchStatements ...................................... 226.4 Subfunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226.5 Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226.5.1 Parsing Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226.5.2 ScreenOutput ........................................ 236.5.3 Screen Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.5.4 Screen Input on a Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Miscellaneous Useful Commands 248 Graphical User Interface 249 SIMULINK 2510 M-book 2511 Useful Unix Commands 2511.1CreatingUnixCommands...................................... 2511.2MoreHelponUnix.......................................... 2612 FAQs 261 IntroductionMATLAB, which stands for MATrix LABoratory, is a software package developed by MathWorks, Inc. tofacillitate numerical computations as well as some symbolic manipulation.1It strikes me as being slightlymore difficult to begin working with than such packages as Maple, Mathematica, and Macsyma, thoughonce you get comfortable with it, it offers greater flexibility. The main point of using it in M442 is that itis currently the package you will most likely find yourself working with if you get a job in engineering orindustrial mathematics.2Beyond these notes (and other class hand-outs), I can suggest three useful resources for help with MAT-LAB: 1. the references listed at the end of these notes, the best of which for our purposes is probably theshort book by Gilat, 2. MATLAB’s extensive built-in help, which you can access from the MATLAB promptwith the command helpdesk, and 3. the Calclab help sessions in which you can typically find at least one ortwo people who not only know MATLAB but have been through this modeling course.2 Starting MATLAB at Texas A&M UniversityYou should have a calclab account assigned to you for M442 (I’ll pass these out on the first day of class, oras soon as I get them). Log in and click on the six pointed geometric figure in the bottom left corner of your1The collection of programs (primarily in Fortran) that eventually became MATLAB were developed in the late 1970s byCleve Moler, who used them in a numerical analysis course he was teaching at the University of New Mexico. Jack Littleand Steve Bangert later reprogrammed these routines in C, and added M-files, toolboxes, and more powerful graphics (originalversions created plots by printing asterisks on the screen). Moler, Little, and Bangert founded MathWorks in California in1984.2If you get a job in a particular field of engineering or industry (as opposed to engineering or industrial mathematics)youwill most likely used specialized software.2screen. Go to Mathematics and choose Matlab. Congratulations! (Alternatively, click on the surface ploticon at the foot of your screen.)3For basic information on using calclab accounts at Texas A&M University—printing, access, etc.—getArt Belmonte’s Maple in Texas A&M’s Mathematics Courses, available at the department web site:http://calclab.math.tamu.edu.3 Simple Computations with MATLAB3.1 What you’re looking atThe (default) MATLAB screen is divided into three windows, with a large Command Window on theright, and two smaller windows stacked one atop the other on


View Full Document

TAMU MATH 308 - matbasics

Download matbasics
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view matbasics and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view matbasics 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?