Example: stock market

Getting Started with MATLAB - UiO

Getting Started with MATLAB Version 7 MATLAB The Language of Technical ComputingHow to Contact The Technical Product enhancement Bug Documentation error Order status, license renewals, Sales, pricing, and general information508-647-7000 Phone508-647-7001 FaxThe MathWorks, Apple Hill DriveNatick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web Started with MATLAB COPYRIGHT 1984 - 2005 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro-duced in any form without prior written consent from The MathWorks, ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR , DFARS Part , and DFARS Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of th

start with this Getting Started book. It covers all the primary MATLAB features at a high level, including many examples. The MATLAB online help provides task-oriented and reference information about MATLAB features. MATLAB documentat ion is also available in printed form and in PDF format. MATLAB Online Help

Tags:

  High, Getting

Information

Domain:

Source:

Link to this page:

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

Other abuse

Transcription of Getting Started with MATLAB - UiO

1 Getting Started with MATLAB Version 7 MATLAB The Language of Technical ComputingHow to Contact The Technical Product enhancement Bug Documentation error Order status, license renewals, Sales, pricing, and general information508-647-7000 Phone508-647-7001 FaxThe MathWorks, Apple Hill DriveNatick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web Started with MATLAB COPYRIGHT 1984 - 2005 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro-duced in any form without prior written consent from The MathWorks, ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR , DFARS Part , and DFARS Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions.

2 If this License fails to meet the government's needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. MATLAB , Simulink, Stateflow, Handle Graphics, Real-Time Workshop, and xPC TargetBox are registered trademarks of The MathWorks, product or brand names are trademarks or registered trademarks of their respective HistoryDecember 1996 First printingFor MATLAB 5 May 1997 Second printing For MATLAB 1998 Third printing For MATLAB 2000 Fourth printing Revised for MATLAB 6 (Release 12)June 2001 Online only Revised for MATLAB (Release )July 2002 Online onlyRevised for MATLAB (Release 13)August 2002 Fifth printingRevised for MATLAB 2004 Sixth printingRevised for MATLAB (Release 14)October 2004 Online onlyRevised for MATLAB (Release 14SP1)March 2005 Online onlyRevised for MATLAB (Release 14SP2)iContents1 IntroductionWhat Is MATLAB ?

3 1-2 The MATLAB System .. 1-3 MATLAB Documentation .. 1-4 MATLAB Online Help .. 1-4 Starting and Quitting MATLAB .. 1-6 Starting MATLAB .. 1-6 Quitting MATLAB .. 1-6 MATLAB Desktop .. 1-72 Matrices and ArraysMatrices and Magic Squares .. 2-2 Entering Matrices .. 2-3sum, transpose, and diag .. 2-4 Subscripts .. 2-6 The Colon Operator .. 2-7 The magic Function .. 2-8 Expressions .. 2-10 Variables .. 2-10 Numbers .. 2-10 Operators .. 2-11 Functions .. 2-11 Examples of Expressions .. 2-13 Working with Matrices .. 2-14 Generating Matrices .. 2-14 The load Function .. 2-15iiContentsM-Files .. 2-15 Concatenation .. 2-16 Deleting Rows and Columns .. 2-17 More About Matrices and Arrays .. 2-18 Linear Algebra .. 2-18 Arrays .. 2-21 Multivariate Data .. 2-24 Scalar Expansion .. 2-25 Logical Subscripting .. 2-26 The find Function .. 2-27 Controlling Command Window Input and Output.

4 2-28 The format Function .. 2-28 Suppressing Output .. 2-30 Entering Long Statements .. 2-30 Command Line Editing .. 2-303 GraphicsOverview of MATLAB Plotting .. 3-2 The Plotting Process .. 3-2 Graph Components .. 3-5 Figure Tools .. 3-7 Arranging Graphs Within a Figure .. 3-13 Selecting Plot Types .. 3-14 Editing Plots .. 3-16 Plot Editing Mode .. 3-16 Using Functions to Edit Graphs .. 3-19 Examples Using MATLAB Plotting Tools .. 3-20 Modifying the Graph Data Source .. 3-27 Preparing Graphs for Presentation .. 3-29 Modify the Graph to Enhance the Presentation .. 3-30iiiPrinting the Graph .. 3-33 Exporting the Graph .. 3-35 Basic Plotting Functions .. 3-38 Creating a Plot .. 3-38 Multiple Data Sets in One Graph .. 3-40 Specifying Line Styles and Colors .. 3-41 Plotting Lines and Markers .. 3-41 Imaginary and Complex Data .. 3-43 Adding Plots to an Existing Graph .. 3-44 Figure Windows .. 3-46 Multiple Plots in One Figure.

5 3-46 Controlling the Axes .. 3-48 Axis Labels and Titles .. 3-49 Saving Figures .. 3-51 Mesh and Surface Plots .. 3-52 Visualizing Functions of Two Variables .. 3-52 Images .. 3-58 Reading and Writing Images .. 3-59 Printing Graphics .. 3-60 Handle Graphics .. 3-62 Using the Handle .. 3-62 Graphics Objects .. 3-63 Setting Object Properties .. 3-65 Specifying the Axes or Figure .. 3-68 Finding the Handles of Existing Objects .. 3-69 Animations .. 3-71 Erase Mode Method .. 3-71 Creating Movies .. 3-73ivContents4 ProgrammingFlow Control .. 4-2if, else, and elseif .. 4-2switch and case .. 4-4for .. 4-5while .. 4-5continue .. 4-6break .. 4-7try - catch .. 4-7return .. 4-8 Other Data Structures .. 4-9 Multidimensional Arrays .. 4-9 Cell Arrays .. 4-11 Characters and Text .. 4-13 Structures .. 4-16 Scripts and Functions .. 4-19 Scripts .. 4-20 Functions .. 4-21 Types of Functions .. 4-23 Global Variables.

6 4-25 Passing String Arguments to Functions .. 4-26 The eval Function .. 4-27 Function Handles .. 4-28 Function Functions .. 4-28 Vectorization .. 4-31 Preallocation .. 4-315 Creating Graphical User InterfacesWhat Is GUIDE? .. 5-2vLaying Out a GUI .. 5-3 Starting GUIDE .. 5-3 The Layout Editor .. 5-4 Programming a GUI .. 5-66 Desktop Tools and Development EnvironmentDesktop Overview .. 6-2 Arranging the Desktop .. 6-3 Start Button .. 6-4 Command Window and Command History .. 6-5 Command Window .. 6-5 Command History .. 6-6 Help Browser .. 6-7 Current Directory Browser and Search Path .. 6-10 Current Directory .. 6-10 Search Path .. 6-11 Workspace Browser and Array Editor .. 6-12 Workspace Browser .. 6-12 Array Editor .. 6-13 Editor/Debugger .. 6-14M-Lint Code Check and Profiler Reports .. 6-16M-Lint Code Check Report .. 6-16 Profiler .. 6-18 Other Development Environment Features .. 6-19viContentsIndex 1 IntroductionWhat Is MATLAB ?

7 (p. 1-2)See how MATLAB can provide solutions for you in technical computing, what are some of the common applications of MATLAB , and what types of add-on application-specific solutions are available in MATLAB Documentation (p. 1-4)Find out where to look for instruction on how to use each component of MATLAB , and where to find help when you need and Quitting MATLAB (p. 1-6)Start a new MATLAB session, use the desktop environment, and terminate the Introduction1-2 What Is MATLAB ? MATLAB is a high -performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include Math and computation Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including graphical user interface buildingMATLAB is an interactive system whose basic data element is an array that does not require dimensioning.

8 This allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar noninteractive language such as C or name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy access to matrix software developed by the LINPACK and EISPACK projects. Today, MATLAB engines incorporate the LAPACK and BLAS libraries, embedding the state of the art in software for matrix computation. MATLAB has evolved over a period of years with input from many users. In university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and science. In industry, MATLAB is the tool of choice for high -productivity research, development, and analysis. MATLAB features a family of add-on application-specific solutions called toolboxes. Very important to most users of MATLAB , toolboxes allow you to learn and apply specialized technology.

9 Toolboxes are comprehensive collections of MATLAB functions (M-files) that extend the MATLAB environment to solve particular classes of problems. Areas in which toolboxes are available include signal processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and many Is MATLAB ?1-3 The MATLAB SystemThe MATLAB system consists of five main parts:Development is the set of tools and facilities that help you use MATLAB functions and files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop and Command Window, a command history, an editor and debugger, and browsers for viewing help, the workspace, files, and the search MATLAB Mathematical Function is a vast collection of computational algorithms ranging from elementary functions, like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix eigenvalues, Bessel functions, and fast Fourier transforms. The MATLAB is a high -level matrix/array language with control flow statements, functions, data structures, input/output, and object-oriented programming features.

10 It allows both programming in the small to rapidly create quick and dirty throw-away programs, and programming in the large to create large and complex application programs. has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. It includes high -level functions for two-dimensional and three-dimensional data visualization, image processing, animation, and presentation graphics. It also includes low-level functions that allow you to fully customize the appearance of graphics as well as to build complete graphical user interfaces on your MATLAB MATLAB External is a library that allows you to write C and Fortran programs that interact with MATLAB . It includes facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing Introduction1-4 MATLAB DocumentationMATLAB provides extensive documentation, in both printed and online format, to help you learn about and use all of its features.


Related search queries