combo matlab

Upload: jorge-cruz-mancilla

Post on 04-Jun-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Combo Matlab

    1/34

    Table of Contents

    MATLAB Fundamentals TOC-1 2012 by MathWorks, Inc.

    MLBE912V1

  • 8/13/2019 Combo Matlab

    2/34

    Table of Contents

    MATLAB Fundamentals TOC-2 2012 by MathWorks, Inc.

    Objetivo

    El objetivo general del curso es dotar a los asistentes de lahabilidad bsica del uso de la herramienta MATLAB, como unsoftware de computo tcnico. Al final el curso, los asistentes

    podrn realizar las 3 tareas bsicas del computo tcnico:Obtener datos de diversos medios; Procesarlos matemticamentey visualizarlos; Compartir los resultados a travs de aplicacionesy reportes .

    Principales Beneficios

    MATLAB es un software lder en el computo cientfico ytcnico, pensado como una plataforma de computo al tiempoque es un poderoso lenguaje de programacin de alto nivel. Sucreacin ha sido pensada en automatizar clculos y realizartareas matemticas complejas de manera interactiva,estructurada y programtica. por lo que su conocimiento bsicoderiva en una reduccin de tiempo en la realizacin de tareas deanlisis y visualizacin de datos, desarrollo de aplicacionessimples y publicacin de resultados.

  • 8/13/2019 Combo Matlab

    3/34

    Table of Contents

    MATLAB Fundamentals TOC-3 2012 by MathWorks, Inc.

    NOSOTROS

    Somos una empresa mexicana con ms de 15 aos de experiencia. Fundadaen 1989 para satisfacer la creciente demanda del mercado especializado deSoftware Cientfico y Tcnico para la Industria, las Ciencias, los Servicios y laEducacin de Mxico y Latinoamrica.Ofrecemos Cursos de MINITAB, MATLAB , MAPLE, entre otrosproductos. Nuestra consultora consiste en el desarrollo de aplicacionescientficas y tcnicas, integracin de sistemas en las reas de control,electrnica, mecnica, finanzas, instrumentacin, medicin, adquisicin/captura de datos en lnea y anlisis en tiempo real para control de procesos .

    Visitenos www.multion.com.mx

    Mayores informes (Cursos)

    Joel CervantesMultiON Consulting, SA de CV Insurgentes Sur 1236-301 Mxico, DF, 03200 MEXICO

    Tel.: (55) 5559-4050 ext. 119Fax: (55) 5559-4048 Country Code: 52

    Email: [email protected]

  • 8/13/2019 Combo Matlab

    4/34

    Table of Contents

    MATLAB Fundamentals TOC-4 2012 by MathWorks, Inc.

    COPYRIGHT 2010-2012 by The MathWorks, Inc.

    This Training Course Notebook, along with other Training Course Examplesand Exercises, shall at all times remain the intellectual property of TheMathWorks, Inc. The MathWorks, Inc. reserves all rights in these materials.No part of these materials may be photocopied, reproduced in any form, ordistributed without prior written consent from The MathWorks, Inc.

    The software described in this document is furnished under a licenseagreement. The software may be used or copied only under the terms of thelicense agreement.

  • 8/13/2019 Combo Matlab

    5/34

    Table of Contents

    MATLAB Fundamentals TOC-5 2012 by MathWorks, Inc.

    Table of Contents

    1. Introduction

    2. Working with the MATLAB User Interface

    3. Variables and Expressions

    4. Analysis and Visualization with Vectors

    5. Analysis and Visualization with Matrices

    6. Automating Commands with Scripts

    7. Working with Data Files

    8. Working with Text and Dates

    9. Multiple Vector Plots

    10. Logic and Flow Control

    11. Matrix and Image Visualization

    12. Data Analysis

    13. Writing Functions

    14. Troubleshooting Code and Improving Performance

    15. Data Types

    16. Conclusion

    Appendices

  • 8/13/2019 Combo Matlab

    6/34

    Table of Contents

    MATLAB Fundamentals TOC-6 2012 by MathWorks, Inc.

    Table of Contents

    1. Introduction

    MathWorks at a Glance........................................................................................................................................................................................................ 1-2

    Worldwide Offices................................................................................................................................................................................................................... 1-3

    MathWorks Product Overview........................................................................................................................................................................................... 1-4

    Diverse Users............................................................................................................................................................................................................................ 1-5

    Computer Setup....................................................................................................................................................................................................................... 1-6

    What Can You Do with MATLAB ?................................................................................................................................................................................... 1-7

    Course Learning Outcomes................................................................................................................................................................................................... 1-8

    Course Outline......................................................................................................................................................................................................................... 1-9

  • 8/13/2019 Combo Matlab

    7/34

    Table of Contents

    MATLAB Fundamentals TOC-7 2012 by MathWorks, Inc.

    Table of Contents

    2. Working with the MATLAB User Interface

    Outline....................................................................................................................................................................................................................................... 2-2

    Chapter 2 Learning Outcomes.............................................................................................................................................................................................. 2-3

    The MATLAB Desktop....................................................................................................................................................................................................... 2-4

    Customizing the Desktop....................................................................................................................................................................................................... 2-5

    Course Example: Gas Price Data.......................................................................................................................................................................................... 2-6

    Interactive Importing.............................................................................................................................................................................................................. 2-7

    Variables in the Base Workspace........................................................................................................................................................................................... 2-8

    The Variable Editor................................................................................................................................................................................................................. 2-9

    New Variables........................................................................................................................................................................................................................... 2-10

    Saving and Loading Variables................................................................................................................................................................................................ 2-11

    Plotting the Data...................................................................................................................................................................................................................... 2-12

    Plot Tools.................................................................................................................................................................................................................................. 2-13

    Multiple Plots........................................................................................................................................................................................................................... 2-14

    Formatting the Plot................................................................................................................................................................................................................. 2-15

    Data Statistics Tool.................................................................................................................................................................................................................. 2-16Basic Fitting Tool..................................................................................................................................................................................................................... 2-17

    Exporting to Another Application....................................................................................................................................................................................... 2-18

    Shortcuts................................................................................................................................................................................................................................... 2-19

    Summary.................................................................................................................................................................................................................................... 2-20

    Chapter 2 Test Your Knowledge........................................................................................................................................................................................... 2-21

  • 8/13/2019 Combo Matlab

    8/34

    Table of Contents

    MATLAB Fundamentals TOC-8 2012 by MathWorks, Inc.

    Table of Contents

    3. Variables and Expressions

    Outline....................................................................................................................................................................................................................................... 3-2

    Chapter 3 Learning Outcomes.............................................................................................................................................................................................. 3-3

    MATLAB Commands.......................................................................................................................................................................................................... 3-4

    Saving and Loading MAT-Files............................................................................................................................................................................................. 3-5

    Assignment............................................................................................................................................................................................................................... 3-6

    Creating Vectors....................................................................................................................................................................................................................... 3-7

    Creating Matrices..................................................................................................................................................................................................................... 3-8

    Matrix Creation Functions..................................................................................................................................................................................................... 3-9

    Help and Documentation....................................................................................................................................................................................................... 3-10

    Row, Column Indexing........................................................................................................................................................................................................... 3-11

    Multiple Row, Column Indices.............................................................................................................................................................................................. 3-12

    Indexed Assignment................................................................................................................................................................................................................ 3-13

    Concatenation.......................................................................................................................................................................................................................... 3-14

    Characters and Strings............................................................................................................................................................................................................. 3-15

    Summary.................................................................................................................................................................................................................................... 3-16Chapter 3 Test Your Knowledge........................................................................................................................................................................................... 3-17

  • 8/13/2019 Combo Matlab

    9/34

    Table of Contents

    MATLAB Fundamentals TOC-9 2012 by MathWorks, Inc.

    Table of Contents

    4. Analysis and Visualization with Vectors

    Outline....................................................................................................................................................................................................................................... 4-2

    Chapter 4 Learning Outcomes.............................................................................................................................................................................................. 4-3

    Statistical Functions................................................................................................................................................................................................................. 4-4

    Array Operations..................................................................................................................................................................................................................... 4-5

    Mathematical Operations....................................................................................................................................................................................................... 4-6

    Plotting Vectors........................................................................................................................................................................................................................ 4-7

    Plot Options............................................................................................................................................................................................................................. 4-8

    Annotating Plots...................................................................................................................................................................................................................... 4-9

    Additional Vector Plot Types................................................................................................................................................................................................. 4-10

    Summary.................................................................................................................................................................................................................................... 4-11

    Chapter 4 Test Your Knowledge........................................................................................................................................................................................... 4-13

  • 8/13/2019 Combo Matlab

    10/34

    Table of Contents

    MATLAB Fundamentals TOC-10 2012 by MathWorks, Inc.

    Table of Contents

    5. Analysis and Visualization with Matrices

    Outline....................................................................................................................................................................................................................................... 5-2

    Chapter 5 Learning Outcomes.............................................................................................................................................................................................. 5-3

    Determining Size..................................................................................................................................................................................................................... 5-4

    Matrix Operations.................................................................................................................................................................................................................... 5-5

    Array Operations..................................................................................................................................................................................................................... 5-6

    Mathematical Operations....................................................................................................................................................................................................... 5-7

    Data in the MATLAB Environment.................................................................................................................................................................................. 5-8

    Statistical Operations............................................................................................................................................................................................................... 5-9

    Plotting Multiple Columns..................................................................................................................................................................................................... 5-10

    Reshaping.................................................................................................................................................................................................................................. 5-11

    Linear Indexing........................................................................................................................................................................................................................ 5-12

    Multidimensional Arrays......................................................................................................................................................................................................... 5-13

    Summary.................................................................................................................................................................................................................................... 5-14

    Chapter 5 Test Your Knowledge........................................................................................................................................................................................... 5-15

  • 8/13/2019 Combo Matlab

    11/34

    Table of Contents

    MATLAB Fundamentals TOC-11 2012 by MathWorks, Inc.

    Table of Contents

    6. Automating Commands with Scripts

    Outline....................................................................................................................................................................................................................................... 6-2

    Chapter 6 Learning Outcomes.............................................................................................................................................................................................. 6-3

    Course Example: Modeling a Whale Call............................................................................................................................................................................ 6-4

    The Command History........................................................................................................................................................................................................... 6-5

    The MATLAB Editor........................................................................................................................................................................................................... 6-6

    Script Files................................................................................................................................................................................................................................. 6-7

    Running a Script....................................................................................................................................................................................................................... 6-8

    Code Sections........................................................................................................................................................................................................................... 6-9

    Publishing Code....................................................................................................................................................................................................................... 6-10

    Summary.................................................................................................................................................................................................................................... 6-11

    Chapter 6 Test Your Knowledge........................................................................................................................................................................................... 6-13

  • 8/13/2019 Combo Matlab

    12/34

    Table of Contents

    MATLAB Fundamentals TOC-12 2012 by MathWorks, Inc.

    Table of Contents

    7. Working with Data Files

    Outline....................................................................................................................................................................................................................................... 7-2

    Chapter 7 Learning Outcomes.............................................................................................................................................................................................. 7-3

    File Types and File Formats .................................................................................................................................................................................................. 7-4

    Reading and Writing Fixed-Format Files............................................................................................................................................................................. 7-5

    Interactively Importing Text Files and Spreadsheets........................................................................................................................................................ 7-6

    Generating File I/O Code...................................................................................................................................................................................................... 7-7

    Exporting Spreadsheets.......................................................................................................................................................................................................... 7-8

    Low-Level File I/O................................................................................................................................................................................................................. 7-9

    Summary.................................................................................................................................................................................................................................... 7-10

    Chapter 7 Test Your Knowledge........................................................................................................................................................................................... 7-11

  • 8/13/2019 Combo Matlab

    13/34

    Table of Contents

    MATLAB Fundamentals TOC-13 2012 by MathWorks, Inc.

    Table of Contents

    8. Working with Text and Dates

    Outline....................................................................................................................................................................................................................................... 8-2

    Chapter 8 Learning Outcomes.............................................................................................................................................................................................. 8-3

    Course Example: Car Specifications..................................................................................................................................................................................... 8-4

    Cell Arrays................................................................................................................................................................................................................................. 8-5

    Cell Indexing............................................................................................................................................................................................................................. 8-6

    Converting Array Types.......................................................................................................................................................................................................... 8-7

    Converting Numbers and Strings.......................................................................................................................................................................................... 8-8

    Course Example: Electricity Consumption......................................................................................................................................................................... 8-9

    Working with Dates................................................................................................................................................................................................................. 8-10

    Plotting with Dates.................................................................................................................................................................................................................. 8-11

    Summary.................................................................................................................................................................................................................................... 8-12

    Chapter 8 Test Your Knowledge........................................................................................................................................................................................... 8-13

  • 8/13/2019 Combo Matlab

    14/34

    Table of Contents

    MATLAB Fundamentals TOC-14 2012 by MathWorks, Inc.

    Table of Contents

    9. Multiple Vector Plots

    Outline....................................................................................................................................................................................................................................... 9-2

    Chapter 9 Learning Outcomes.............................................................................................................................................................................................. 9-3

    Graphics Structure................................................................................................................................................................................................................... 9-4

    Multiple Figures....................................................................................................................................................................................................................... 9-5

    Multiple Axes............................................................................................................................................................................................................................ 9-6

    Multiple Plots........................................................................................................................................................................................................................... 9-7

    Plotting Functions................................................................................................................................................................................................................... 9-8

    Annotation Techniques........................................................................................................................................................................................................... 9-9

    Using Color............................................................................................................................................................................................................................... 9-10

    Customizing Plots.................................................................................................................................................................................................................... 9-11

    Axis Control............................................................................................................................................................................................................................. 9-12

    Summary.................................................................................................................................................................................................................................... 9-13

    Chapter 9 Test Your Knowledge........................................................................................................................................................................................... 9-15

  • 8/13/2019 Combo Matlab

    15/34

    Table of Contents

    MATLAB Fundamentals TOC-15 2012 by MathWorks, Inc.

    Table of Contents

    10. Logic and Flow Control

    Outline....................................................................................................................................................................................................................................... 10-2

    Chapter 10 Learning Outcomes............................................................................................................................................................................................ 10-3

    Logical Operations and Variables.......................................................................................................................................................................................... 10-4

    Logical Functions..................................................................................................................................................................................................................... 10-5

    Finding and Counting............................................................................................................................................................................................................. 10-6

    Logical Indexing....................................................................................................................................................................................................................... 10-7

    Programming Constructs....................................................................................................................................................................................................... 10-8

    User Interaction....................................................................................................................................................................................................................... 10-9

    Flow Control............................................................................................................................................................................................................................ 10-10

    For-Loops................................................................................................................................................................................................................................. 10-11

    While-Loops............................................................................................................................................................................................................................. 10-12

    Summary.................................................................................................................................................................................................................................... 10-13

    Chapter 10 Test Your Knowledge......................................................................................................................................................................................... 10-15

  • 8/13/2019 Combo Matlab

    16/34

    Table of Contents

    MATLAB Fundamentals TOC-16 2012 by MathWorks, Inc.

    Table of Contents

    11. Matrix and Image Visualization

    Outline....................................................................................................................................................................................................................................... 11-2

    Chapter 11 Learning Outcomes............................................................................................................................................................................................ 11-3

    Course Example: Ozone Measurements.............................................................................................................................................................................. 11-4

    Making Grids............................................................................................................................................................................................................................ 11-5

    Interpolating Scattered Data.................................................................................................................................................................................................. 11-6

    Surface Plots............................................................................................................................................................................................................................. 11-7

    Two-Dimensional Matrix Visualization................................................................................................................................................................................ 11-8

    Indexed Images........................................................................................................................................................................................................................ 11-9

    Colormaps................................................................................................................................................................................................................................. 11-10

    True Color Images................................................................................................................................................................................................................... 11-11

    Summary.................................................................................................................................................................................................................................... 11-12

    Chapter 11 Test Your Knowledge......................................................................................................................................................................................... 11-13

  • 8/13/2019 Combo Matlab

    17/34

    Table of Contents

    MATLAB Fundamentals TOC-17 2012 by MathWorks, Inc.

    Table of Contents

    12. Data Analysis

    Outline....................................................................................................................................................................................................................................... 12-2

    Chapter 12 Learning Outcomes............................................................................................................................................................................................ 12-3

    Course Example: Modeling Electricity Consumption....................................................................................................................................................... 12-4

    Dealing with Missing Data..................................................................................................................................................................................................... 12-5

    Piecewise Interpolation........................................................................................................................................................................................................... 12-6

    Linear Correlation................................................................................................................................................................................................................... 12-7

    Smoothing and Convolution ................................................................................................................................................................................................. 12-8

    Polynomial Fitting.................................................................................................................................................................................................................... 12-9

    Linear Regression Models...................................................................................................................................................................................................... 12-10

    Frequency Analysis.................................................................................................................................................................................................................. 12-11

    FFTs........................................................................................................................................................................................................................................... 12-12

    Matrix Equations..................................................................................................................................................................................................................... 12-13

    Slash and Backslash................................................................................................................................................................................................................. 12-14

    Solving Linear Systems........................................................................................................................................................................................................... 12-15

    Summary.................................................................................................................................................................................................................................... 12-16

    Chapter 12 Test Your Knowledge......................................................................................................................................................................................... 12-17

  • 8/13/2019 Combo Matlab

    18/34

    Table of Contents

    MATLAB Fundamentals TOC-18 2012 by MathWorks, Inc.

    Table of Contents

    13. Writing Functions

    Outline....................................................................................................................................................................................................................................... 13-2

    Chapter 13 Learning Outcomes............................................................................................................................................................................................ 13-3

    Increasing Automation........................................................................................................................................................................................................... 13-4

    Creating a Function................................................................................................................................................................................................................. 13-5

    Calling a Function.................................................................................................................................................................................................................... 13-6

    Workspaces............................................................................................................................................................................................................................... 13-7

    Subfunctions............................................................................................................................................................................................................................. 13-8

    Calling Precedence................................................................................................................................................................................................................... 13-9

    The MATLAB Path.............................................................................................................................................................................................................. 13-10

    Summary.................................................................................................................................................................................................................................... 13-11

    Chapter 13 Test Your Knowledge......................................................................................................................................................................................... 13-13

  • 8/13/2019 Combo Matlab

    19/34

    Table of Contents

    MATLAB Fundamentals TOC-19 2012 by MathWorks, Inc.

    Table of Contents

    14. Troubleshooting Code and Improving Performance

    Outline....................................................................................................................................................................................................................................... 14-2

    Chapter 14 Learning Outcomes............................................................................................................................................................................................ 14-3

    Debugging................................................................................................................................................................................................................................. 14-4

    Analyzing Code in the Editor................................................................................................................................................................................................ 14-5

    Using Breakpoints.................................................................................................................................................................................................................... 14-6

    Examining Values.................................................................................................................................................................................................................... 14-7

    Ending Debugging.................................................................................................................................................................................................................. 14-8

    Code Performance................................................................................................................................................................................................................... 14-9

    Preallocation of Memory........................................................................................................................................................................................................ 14-10

    Vectorization............................................................................................................................................................................................................................. 14-11

    Summary.................................................................................................................................................................................................................................... 14-12

    Chapter 14 Test Your Knowledge......................................................................................................................................................................................... 14-13

  • 8/13/2019 Combo Matlab

    20/34

    Table of Contents

    MATLAB Fundamentals TOC-20 2012 by MathWorks, Inc.

    Table of Contents

    15. Data Types

    Outline....................................................................................................................................................................................................................................... 15-2

    Chapter 15 Learning Outcomes............................................................................................................................................................................................ 15-3

    MATLAB Data Types........................................................................................................................................................................................................... 15-4

    Integer Arrays........................................................................................................................................................................................................................... 15-5

    Nondouble Arithmetic............................................................................................................................................................................................................ 15-6

    Structures.................................................................................................................................................................................................................................. 15-7

    Structure Arrays....................................................................................................................................................................................................................... 15-8

    Indexing into Structure Arrays.............................................................................................................................................................................................. 15-9

    Function Handles..................................................................................................................................................................................................................... 15-10

    Converting Types..................................................................................................................................................................................................................... 15-11

    Summary.................................................................................................................................................................................................................................... 15-12

    Chapter 15 Test Your Knowledge......................................................................................................................................................................................... 15-13

  • 8/13/2019 Combo Matlab

    21/34

    Table of Contents

    MATLAB Fundamentals TOC-21 2012 by MathWorks, Inc.

    Table of Contents

    Appendices

    MATLAB Reference............................................................................................................................................................................................................. A

    Exercises.................................................................................................................................................................................................................................... B

  • 8/13/2019 Combo Matlab

    22/34

    Table of Contents

    MATLAB Programming TechniquesTOC-1 2012 by MathWorks, Inc.

    MLPR912V2

  • 8/13/2019 Combo Matlab

    23/34

    Table of Contents

    MATLAB Programming TechniquesTOC-2 2012 by MathWorks, Inc.

    Objetivo

    El objetivo general del curso es dotar a los asistentes de lahabilidad para la programacin en MATLAB, como un softwarede computo tcnico. Al final el curso, los asistentes podrn

    programar y realizar aplicaciones diversas que le servirn parael anlisis y visualizacin de su informacin; as como paradesarrollar programas ms robustos y eficientes.

    Principales Beneficios

    MATLAB es un software lder en el computo cientfico ytcnico, pensado como una plataforma de computo al tiempoque es un poderoso lenguaje de programacin de alto nivel. Sucreacin ha sido pensada en automatizar clculos y realizartareas matemticas complejas de manera interactiva,estructurada y programtica. por lo que su conocimiento bsicoderiva en una reduccin de tiempo en la realizacin de tareas deanlisis y visualizacin de datos, desarrollo de aplicacionessimples y publicacin de resultados.

  • 8/13/2019 Combo Matlab

    24/34

    Table of Contents

    MATLAB Programming TechniquesTOC-3 2012 by MathWorks, Inc.

    NOSOTROS

    Somos una empresa mexicana con ms de 15 aos de experiencia. Fundadaen 1989 para satisfacer la creciente demanda del mercado especializado deSoftware Cientfico y Tcnico para la Industria, las Ciencias, los Servicios y laEducacin de Mxico y Latinoamrica.Ofrecemos Cursos de MINITAB, MATLAB , MAPLE, entre otrosproductos. Nuestra consultora consiste en el desarrollo de aplicacionescientficas y tcnicas, integracin de sistemas en las reas de control,electrnica, mecnica, finanzas, instrumentacin, medicin, adquisicin/captura de datos en lnea y anlisis en tiempo real para control de procesos .

    Visitenos www.multion.com.mx Mayores informes (Cursos)

    Joel CervantesMultiON Consulting, SA de CV Insurgentes Sur 1236-301 Mxico, DF, 03200 MEXICO

    Tel.: (55) 5559-4050 ext. 119Fax: (55) 5559-4048 Country Code: 52

    Email: [email protected]

  • 8/13/2019 Combo Matlab

    25/34

    Table of Contents

    MATLAB Programming TechniquesTOC-4 2012 by MathWorks, Inc.

    COPYRIGHT 2010-2012 by The MathWorks, Inc.

    This Training Course Notebook, a long with other Training Course Examplesand Exercises, shall at all times remain the intellectual property of TheMathWorks, Inc. The MathWorks, Inc. reserves all rights in these materials.No part of these materials may be photocopied, reproduced in any form, ordistributed without prior written consent from The MathWorks, Inc.

    The software described in this document is furnished under a licenseagreement. The software may be used or copied only under the terms of thelicense agreement.

  • 8/13/2019 Combo Matlab

    26/34

    Table of Contents

    MATLAB Programming TechniquesTOC-5 2012 by MathWorks, Inc.

    Table of Contents

    1. Introduction

    2. Creating Robust Applications

    3. Development Tools

    4. Structuring Code

    5. Structuring Data

    6.

    Efficient Data Management

    7. Classes and Objects

    8. Conclusion

    Appendices

  • 8/13/2019 Combo Matlab

    27/34

    Table of Contents

    MATLAB Programming TechniquesTOC-6 2012 by MathWorks, Inc.

    Table of Contents

    1. Introduction

    MathWorks at a Glance........................................................................................................................................................................................................ 1-2

    Worldwide Offices................................................................................................................................................................................................................... 1-3

    MathWorks Product Overview........................................................................................................................................................................................... 1-4

    Diverse Users............................................................................................................................................................................................................................ 1-5

    Computer Setup....................................................................................................................................................................................................................... 1-6

    Course Learning Outcomes................................................................................................................................................................................................... 1-7

    Course Outline......................................................................................................................................................................................................................... 1-8

  • 8/13/2019 Combo Matlab

    28/34

    Table of Contents

    MATLAB Programming TechniquesTOC-7 2012 by MathWorks, Inc.

    Table of Contents

    2. Creating Robust Applications

    Outline....................................................................................................................................................................................................................................... 2-2

    Chapter 2 Learning Outcomes.............................................................................................................................................................................................. 2-3

    Course Example: Satellite Tracking....................................................................................................................................................................................... 2-4

    Setting Default Function Inputs............................................................................................................................................................................................ 2-5

    Warnings and Errors............................................................................................................................................................................................................... 2-6

    Checking for Error Conditions............................................................................................................................................................................................. 2-7

    Flexible Interfaces.................................................................................................................................................................................................................... 2-8

    Parsing Property-Value Lists.................................................................................................................................................................................................. 2-9

    The try-catch Construct......................................................................................................................................................................................................... 2-10

    The MException Object......................................................................................................................................................................................................... 2-11

    Summary.................................................................................................................................................................................................................................... 2-12

    Chapter 2 Test Your Knowledge........................................................................................................................................................................................... 2-13

  • 8/13/2019 Combo Matlab

    29/34

    Table of Contents

    MATLAB Programming TechniquesTOC-8 2012 by MathWorks, Inc.

    Table of Contents

    3. Development Tools

    Outline....................................................................................................................................................................................................................................... 3-2

    Chapter 3 Learning Outcomes.............................................................................................................................................................................................. 3-3

    Course Example: Satellite Tracking....................................................................................................................................................................................... 3-4

    Directory Tools........................................................................................................................................................................................................................ 3-5

    Analyzing Code in the Editor................................................................................................................................................................................................ 3-6

    Resolving Dependencies......................................................................................................................................................................................................... 3-7

    Entering Debug Mode............................................................................................................................................................................................................ 3-8

    Examining Values.................................................................................................................................................................................................................... 3-9

    Other Considerations.............................................................................................................................................................................................................. 3-10

    Diagnosing Performance........................................................................................................................................................................................................ 3-11

    MATLAB Profiler................................................................................................................................................................................................................. 3-12

    Summary.................................................................................................................................................................................................................................... 3-13

    Chapter 3 Test Your Knowledge........................................................................................................................................................................................... 3-14

  • 8/13/2019 Combo Matlab

    30/34

    Table of Contents

    MATLAB Programming TechniquesTOC-9 2012 by MathWorks, Inc.

    Table of Contents

    4. Structuring Code

    Outline....................................................................................................................................................................................................................................... 4-2

    Chapter 4 Learning Outcomes.............................................................................................................................................................................................. 4-3

    Private Functions..................................................................................................................................................................................................................... 4-4

    Subfunctions............................................................................................................................................................................................................................. 4-5

    Nested Functions..................................................................................................................................................................................................................... 4-6

    Function Handles..................................................................................................................................................................................................................... 4-7

    Anonymous Functions............................................................................................................................................................................................................ 4-8

    Changing Interface with Anonymous Functions............................................................................................................................................................... 4-9

    Precedence Rules..................................................................................................................................................................................................................... 4-10

    Comparison of Function Types............................................................................................................................................................................................ 4-11

    Summary.................................................................................................................................................................................................................................... 4-12

    Chapter 4 Test Your Knowledge........................................................................................................................................................................................... 4-13

  • 8/13/2019 Combo Matlab

    31/34

    Table of Contents

    MATLAB Programming TechniquesTOC-10 2012 by MathWorks, Inc.

    Table of Contents

    5. Structuring Data

    Outline....................................................................................................................................................................................................................................... 5-2

    Chapter 5 Learning Outcomes.............................................................................................................................................................................................. 5-3

    Course Example: Seismic Data ............................................................................................................................................................................................ 5-4

    Considerations for Structuring Data.................................................................................................................................................................................... 5-5

    Optimizing File I/O................................................................................................................................................................................................................ 5-6

    Cells and Structures................................................................................................................................................................................................................. 5-7

    Indexing into Cells and Structures........................................................................................................................................................................................ 5-8

    Extraction and Concatenation............................................................................................................................................................................................... 5-9

    Converting Cells and Structures............................................................................................................................................................................................ 5-10

    Memory Usage......................................................................................................................................................................................................................... 5-11

    Other Data Types..................................................................................................................................................................................................................... 5-12

    Summary.................................................................................................................................................................................................................................... 5-13

    Chapter 5 Test Your Knowledge........................................................................................................................................................................................... 5-14

  • 8/13/2019 Combo Matlab

    32/34

    Table of Contents

    MATLAB Programming TechniquesTOC-11 2012 by MathWorks, Inc.

    Table of Contents

    6. Efficient Data Management

    Outline....................................................................................................................................................................................................................................... 6-2

    Chapter 6 Learning Outcomes.............................................................................................................................................................................................. 6-3

    Preallocation............................................................................................................................................................................................................................. 6-4

    Preallocating Cells and Structures......................................................................................................................................................................................... 6-5

    Vectorization............................................................................................................................................................................................................................. 6-6

    Applying Scalar Functions to Arrays.................................................................................................................................................................................... 6-7

    Vectorizing and Memory........................................................................................................................................................................................................ 6-8

    Copy-on-Write Behavior......................................................................................................................................................................................................... 6-9

    In-Place Optimizations........................................................................................................................................................................................................... 6-10

    Memory Anatomy.................................................................................................................................................................................................................... 6-11

    Summary.................................................................................................................................................................................................................................... 6-12

    Chapter 6 Test Your Knowledge........................................................................................................................................................................................... 6-13

  • 8/13/2019 Combo Matlab

    33/34

    Table of Contents

    MATLAB Programming TechniquesTOC-12 2012 by MathWorks, Inc.

    Table of Contents

    7. Classes and Objects

    Outline....................................................................................................................................................................................................................................... 7-2

    Chapter 7 Learning Outcomes.............................................................................................................................................................................................. 7-3

    Custom Data Types................................................................................................................................................................................................................. 7-4

    Course Example: A Lookup Table........................................................................................................................................................................................ 7-5

    Why Write a Class?.................................................................................................................................................................................................................. 7-6

    Class Definition Files.............................................................................................................................................................................................................. 7-7

    Properties.................................................................................................................................................................................................................................. 7-8

    Methods..................................................................................................................................................................................................................................... 7-9

    Property Attributes.................................................................................................................................................................................................................. 7-10

    Creating a Table Object.......................................................................................................................................................................................................... 7-11

    The Constructor Method....................................................................................................................................................................................................... 7-12

    Handle Classes.......................................................................................................................................................................................................................... 7-13

    Precedence Rules..................................................................................................................................................................................................................... 7-14

    Overloading Methods.............................................................................................................................................................................................................. 7-15

    Overloading Operators........................................................................................................................................................................................................... 7-16

    Code Reuse............................................................................................................................................................................................................................... 7-17

    Summary.................................................................................................................................................................................................................................... 7-18

    Chapter 7 Test Your Knowledge........................................................................................................................................................................................... 7-19

  • 8/13/2019 Combo Matlab

    34/34

    Table of Contents

    MATLAB Programming TechniquesTOC-13 2012 by MathWorks, Inc.

    Table of Contents

    Appendices

    Exercises.................................................................................................................................................................................................................................... A