refbook1.pdf - MATLAB 7 Function Reference Volume 1(A-E How to Contact The MathWorks Web Newsgroup www.mathworks.com\/contact_TS.html Technical Support

refbook1.pdf - MATLAB 7 Function Reference Volume 1(A-E How...

This preview shows page 1 out of 1298 pages.

You've reached the end of your free preview.

Want to read all 1298 pages?

Unformatted text preview: MATLAB® 7 Function Reference: Volume 1 (A-E) How to Contact The MathWorks Web Newsgroup Technical Support comp.soft-sys.matlab [email protected] [email protected] [email protected] [email protected] [email protected] Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information 508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web site. MATLAB Function Reference © COPYRIGHT 1984–2007 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 reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL 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 12.212, DFARS Part 227.72, and DFARS 252.227-7014. 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. 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. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Patents The MathWorks products are protected by one or more U.S. patents. Please see for more information. Revision History December 1996 June 1997 October 1997 January 1999 June 1999 June 2001 July 2002 June 2004 September 2006 September 2007 First printing Online only Online only Online only Second printing Online only Online only Online only Online only Online only For MATLAB 5.0 (Release 8) Revised for MATLAB 5.1 (Release 9) Revised for MATLAB 5.2 (Release 10) Revised for MATLAB 5.3 (Release 11) For MATLAB 5.3 (Release 11) Revised for MATLAB 6.1 (Release 12.1) Revised for 6.5 (Release 13) Revised for 7.0 (Release 14) Revised for 7.3 (Release 2006b) Revised for 7.5 (Release 2007b) Contents Function Reference 1 Desktop Tools and Development Environment . . . . . . . Startup and Shutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command Window and History . . . . . . . . . . . . . . . . . . . . . . Help for Using MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . Workspace, Search Path, and File Operations . . . . . . . . . . Programming Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 1-3 1-4 1-5 1-6 1-8 1-11 Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Arrays and Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Linear Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Elementary Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Interpolation and Computational Geometry . . . . . . . . . . . . Cartesian Coordinate System Conversion . . . . . . . . . . . . . . Nonlinear Numerical Methods . . . . . . . . . . . . . . . . . . . . . . . Specialized Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sparse Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Math Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 1-14 1-19 1-23 1-28 1-28 1-31 1-31 1-35 1-36 1-39 Data Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Descriptive Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Filtering and Convolution . . . . . . . . . . . . . . . . . . . . . . . . . . . Interpolation and Regression . . . . . . . . . . . . . . . . . . . . . . . . Fourier Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Derivatives and Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . Time Series Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Time Series Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-41 1-41 1-41 1-42 1-42 1-43 1-43 1-44 1-47 Programming and Data Types . . . . . . . . . . . . . . . . . . . . . . Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Type Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators and Special Characters . . . . . . . . . . . . . . . . . . . . String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-49 1-49 1-57 1-59 1-62 v Bit-wise Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Logical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Relational Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date and Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . Programming in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . 1-65 1-65 1-66 1-66 1-67 1-67 MATLAB® Classes and Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-75 1-75 File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Name Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . Opening, Loading, Saving Files . . . . . . . . . . . . . . . . . . . . . . Memory Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Low-Level File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Spreadsheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Scientific Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Audio and Audio/Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Internet Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-78 1-78 1-79 1-79 1-79 1-80 1-81 1-81 1-82 1-83 1-85 1-86 Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Plots and Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Plotting Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Annotating Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specialized Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bit-Mapped Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Handle Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-88 1-88 1-89 1-89 1-90 1-94 1-94 1-95 3-D Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Surface and Mesh Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . View Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Volume Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-99 1-99 1-101 1-103 1-103 1-104 Creating Graphical User Interfaces . . . . . . . . . . . . . . . . . 1-106 Predefined Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-106 vi Contents Deploying User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . Developing User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . User Interface Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Finding Objects from Callbacks . . . . . . . . . . . . . . . . . . . . . . GUI Utility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controlling Program Execution . . . . . . . . . . . . . . . . . . . . . . 1-107 1-107 1-108 1-109 1-109 1-110 External Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dynamic Link Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Component Object Model and ActiveX . . . . . . . . . . . . . . . . . Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Serial Port Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-111 1-111 1-112 1-113 1-115 1-116 Functions — Alphabetical List 2 Index vii viii Contents 1 Function Reference Desktop Tools and Development Environment (p. 1-3) Startup, Command Window, help, editing and debugging, tuning, other general functions Mathematics (p. 1-13) Arrays and matrices, linear algebra, other areas of mathematics Data Analysis (p. 1-41) Basic data operations, descriptive statistics, covariance and correlation, filtering and convolution, numerical derivatives and integrals, Fourier transforms, time series analysis Programming and Data Types (p. 1-49) Function/expression evaluation, program control, function handles, object oriented programming, error handling, operators, data types, dates and times, timers MATLAB® Classes and Object-Oriented Programming (p. 1-75) Functions for working with classes and objects File I/O (p. 1-78) General and low-level file I/O, plus specific file formats, like audio, spreadsheet, HDF, images Graphics (p. 1-88) Line plots, annotating graphs, specialized plots, images, printing, Handle Graphics 3-D Visualization (p. 1-99) Surface and mesh plots, view control, lighting and transparency, volume visualization 1 1-2 Function Reference Creating Graphical User Interfaces (p. 1-106) GUIDE, programming graphical user interfaces External Interfaces (p. 1-111) Interfaces to DLLs, Java, COM and ActiveX, Web services, and serial port devices, and C and Fortran routines Desktop Tools and Development Environment Desktop Tools and Development Environment Startup and Shutdown (p. 1-3) Startup and shutdown options, preferences Command Window and History (p. 1-4) Control Command Window and History, enter statements and run functions Help for Using MATLAB (p. 1-5) Command line help, online documentation in the Help browser, demos Workspace, Search Path, and File Operations (p. 1-6) Work with files, MATLAB search path, manage variables Programming Tools (p. 1-8) Edit and debug M-files, improve performance, source control, publish results System (p. 1-11) Identify current computer, license, product version, and more Startup and Shutdown exit Terminate MATLAB® program (same as quit) finish Termination M-file for MATLAB program matlab (UNIX) Start MATLAB program (The Open Group UNIX® systems) matlab (Windows) Start MATLAB program (Windows® systems) matlabrc Startup M-file for MATLAB program prefdir Directory containing preferences, history, and layout files preferences Open Preferences dialog box for MATLAB and related products 1-3 1 Function Reference quit Terminate the MATLAB program startup Startup M-file for user-defined options userpath View or change user portion of search path Command Window and History 1-4 clc Clear Command Window commandhistory Open Command History window, or select it if already open commandwindow Open Command Window, or select it if already open diary Save session to file dos Execute DOS command and return result format Set display format for output home Move cursor to upper-left corner of Command Window matlabcolon (matlab:) Run specified function via hyperlink more Control paged output for Command Window perl Call Perl script using appropriate operating system executable system Execute operating system command and return result unix Execute UNIX command and return result Desktop Tools and Development Environment Help for Using MATLAB builddocsearchdb Build searchable documentation database demo Access product demos via Help browser doc Reference page in Help browser docopt Web browser for UNIX platforms docsearch Open Help browser Search pane and search for specified term echodemo Run M-file demo step-by-step in Command Window help Help for MATLAB functions in Command Window helpbrowser Open Help browser to access all online documentation and demos helpwin Provide access to M-file help for all functions info Information about contacting The MathWorks lookfor Search for keyword in all help entries playshow Run M-file demo (deprecated; use echodemo instead) support Open MathWorks Technical Support Web page web Open Web site or file in Web browser or Help browser whatsnew Release Notes for MathWorks™ products 1-5 1 Function Reference Workspace, Search Path, and File Operations Workspace (p. 1-6) Manage variables Search Path (p. 1-6) View and change MATLAB search path File Operations (p. 1-7) View and change files and directories Workspace assignin Assign value to variable in specified workspace clear Remove items from workspace, freeing up system memory evalin Execute MATLAB expression in specified workspace exist Check existence of variable, function, directory, or Java™ programming language class openvar Open workspace variable in Variable Editor or other tool for graphical editing pack Consolidate workspace memory uiimport Open Import Wizard to import data which Locate functions and files workspace Open Workspace browser to manage workspace Search Path 1-6 addpath Add directories to search path genpath Generate path string partialpath Partial pathname description Desktop Tools and Development Environment path View or change search path path2rc Save current search path to pathdef.m file pathdef Directories in search path pathsep Path separator for current platform pathtool Open Set Path dialog box to view and change search path restoredefaultpath Restore default search path rmpath Remove directories from search path savepath Save current search path to pathdef.m file userpath View or change user portion of search path File Operations See also “File I/O” on page 1-78 functions. cd Change working directory copyfile Copy file or directory delete Remove files or graphics objects dir Directory listing exist Check existence of variable, function, directory, or Java programming language class fileattrib Set or get attributes of file or directory filebrowser Current Directory browser isdir Determine whether input is a directory lookfor Search for keyword in all help entries 1-7 1 Function Reference ls Directory contents on UNIX platform matlabroot Root directory mkdir Make new directory movefile Move file or directory pwd Identify current directory recycle Set option to move deleted files to recycle folder rehash Refresh function and file system path caches rmdir Remove directory toolboxdir Root directory for specified toolbox type Display contents of file what List MATLAB files in current directory which Locate functions and files Programming Tools 1-8 Edit and Debug M-Files (p. 1-9) Edit and debug M-files Improve Performance and Tune M-Files (p. 1-9) Improve performance and find potential problems in M-files Source Control (p. 1-10) Interface MATLAB with source control system Publishing (p. 1-10) Publish M-file code and results Desktop Tools and Development Environment Edit and Debug M-Files clipboard Copy and paste strings to and from system clipboard datatipinfo Produce short description of input variable dbclear Clear breakpoints dbcont Resume execution dbdown Change local workspace context when in debug mode dbquit Quit debug mode dbstack Function call stack dbstatus List all breakpoints dbstep Execute one or more lines from current breakpoint dbstop Set breakpoints dbtype List M-file with line numbers dbup Change local workspace context debug List M-file debugging functions edit Edit or create M-file keyboard Input from keyboard Improve Performance and Tune M-Files bench MATLAB Benchmark mlint Check M-files for possible problems mlintrpt Run mlint for file or directory, reporting results in browser pack Consolidate workspace memory profile Profile execution time for function 1-9 1 Function Reference profsave Save profile report in HTML format rehash Refresh function and file system path caches sparse Create sparse matrix zeros Create array of all zeros Source Control checkin Check files into a source control system (UNIX platforms) checkout Check files out of a source control system (UNIX platforms) cmopts Name of source control system customverctrl Allow custom source control system (UNIX platforms) undocheckout Undo previous checkout from source control system (UNIX platforms) verctrl Source control actions (Windows platforms) Publishing 1-10 grabcode MATLAB code from M-files published to HTML notebook Open M-book in Microsoft® Word (MicrosoftWindows platforms) publish Publish M-file containing cells, saving output to a file of specified type Desktop Tools and Development Environment System Operating System Interface (p. 1-11) Exchange operating system information and commands with MATLAB MATLAB Version and License (p. 1-12) Information about MATLAB version and license Operating System Interface clipboard Copy and paste strings to and from system clipboard computer Information about computer on which MATLAB software is running dos Execute DOS command and return result getenv Environment variable hostid MATLAB server host identification number maxNumCompThreads Controls maximum number of computational threads perl Call Perl script using appropriate operating system executable setenv Set environment variable system Execute operating system command and return result unix Execute UNIX command and return result winqueryreg Item from Microsoft Windows registry 1-11 1 Function Reference MATLAB Version and License ismac Determine if running MATLAB for Macintosh® OS X platform ispc Determine if running MATLAB for PC (Windows) platform isstudent Determine whether Student Version of MATLAB isunix Determine if running MATLAB for UNIX platform.1 javachk Generate error message based on Sun™ Java feature support license Return license number or perform licensing task prefdir Directory containing preferences, history, and layout files usejava Determine whether Sun Java feature is supported in MATLAB software ver Version information for MathWorks products verLessThan Compare toolbox version to specified version string version Version number for the MATLAB software 1. UNIX is a registered trademark of The Open Group in the United States and other countries 1-12 Mathematics Mathematics Arrays and Matrices (p. 1-14) Basic array operators and operations, cr...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes