MATLAB Function Reference Volume 2: F - O Version 6 How to Contact the Mathworks
Total Page:16
File Type:pdf, Size:1020Kb
MATLAB® The Language of Technical Computing Computation Visualization Programming MATLAB Function Reference Volume 2: F - O Version 6 How to Contact The MathWorks: 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc. Mail 3 Apple Hill Drive Natick, MA 01760-2098 http://www.mathworks.com Web ftp.mathworks.com Anonymous FTP server comp.soft-sys.matlab Newsgroup [email protected] Technical support [email protected] Product enhancement suggestions [email protected] Bug reports [email protected] Documentation error reports [email protected] Subscribing user registration [email protected] Order status, license renewals, passcodes [email protected] Sales, pricing, and general information MATLAB Function Reference Volume 2 F- O COPYRIGHT 1984 - 2000 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro- duced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal government of the United States. By accepting delivery of the Program, the government hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR Part 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part 252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertain to the government’s use and disclosure of the Program and Documentation, and shall supersede any conflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to MathWorks. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Language Compiler is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders. Printing History: December 1996 First printing New for MATLAB 5.0 (Release 10) June 1997 Revised for 5.1 Online version, MATLAB 5.1 October 1997 Revised for 5.2 Online version, MATLAB 5.2 January 1999 Revised for 5.3 Online version (Release 11) June 1999 Second printing MATLAB 5.3 (Release 11) November 2000 Revised for 6.0 Online version (Release 12) Contents Functions by Category 1 General Purpose Commands . viii Operators and Special Characters . x Logical Functions . xi Language Constructs and Debugging . xi Elementary Matrices and Matrix Manipulation . xiii Specialized Matrices . xv Elementary Math Functions . xv Specialized Math Functions . xvi Coordinate System Conversion . xvii Matrix Functions - Numerical Linear Algebra . xvii Data Analysis and Fourier Transform Functions . xviii Polynomial and Interpolation Functions . xix Function Functions – Nonlinear Numerical Methods . xx Sparse Matrix Functions . xxi Sound Processing Functions . xxiii Character String Functions . xxiii File I/O Functions . xxv ii Bitwise Functions . xxvi Structure Functions . xxvi MATLAB Object Functions . xxvi MATLAB Interface to Java . xxvi Cell Array Functions . xxvii Multidimensional Array Functions . xxvii Plotting and Data Visualization . xxvii Graphical User Interfaces . xxxiv Serial Port I/O . xxxv Volume 2 Reference Index iii Contents iv Contents v Contents 1 Functions by Category This section lists MATLAB functions grouped by functional area. General Purpose Commands Operators and Special Characters Logical Functions Language Constructs and Debugging Elementary Matrices and Matrix Manipulation Specialized Matrices Elementary Math Functions Specialized Math Functions Coordinate System Conversion Matrix Functions - Numerical Linear Algebra Data Analysis and Fourier Transform Functions Polynomial and Interpolation Functions Function Functions – Nonlinear Numerical Methods Sparse Matrix Functions Sound Processing Functions Character String Functions File I/O Functions Bitwise Functions Structure Functions MATLAB Object Functions MATLAB Interface to Java Cell Array Functions 1-vii Multidimensional Array Functions Plotting and Data Visualization Graphical User Interface Creation Serial Port I/O General Purpose Commands Managing Commands and Functions addpath Add directories to MATLAB’s search path doc Display HTML documentation in Help browser docopt Display location of help file directory for UNIX platforms genpath Generate a path string help Display M-file help for MATLAB functions in the Command Window helpbrowser Display Help browser for access to all MathWorks online help helpdesk Display the Help browser helpwin Display M-file help and provide access to M-file help for all functions lasterr Last error message lastwarn Last warning message license Show MATLAB license number lookfor Search for specified keyword in all help entries partialpath Partial pathname path Control MATLAB’s directory search path pathtool Open the GUI for viewing and modifying MATLAB’s path profile Start the M-file profiler, a utility for debugging and optimizing code profreport Generate a profile report rehash Refresh function and file system caches rmpath Remove directories from MATLAB’s search path support Open MathWorks Technical Support Web Page type List file ver Display version information for MATLAB, Simulink, and toolboxes version Get MATLAB version number web Point Help browser or Web browser at file or Web site what List MATLAB-specific files in current directory whatsnew Display README files for MATLAB and toolboxes which Locate functions and files 1-viii Managing Variables and the Workspace clear Remove items from the workspace disp Display text or array length Length of vector load Retrieve variables from disk memory Help for memory limitations mlock Prevent M-file clearing munlock Allow M-file clearing openvar Open workspace variable in Array Editor, for graphical editing pack Consolidate workspace memory save Save workspace variables on disk saveas Save figure or model using specified format size Array dimensions who, whos List the variables in the workspace workspace Display the Workspace Browser, a GUI for managing the workspace Controlling the Command Window clc Clear Command Window echo Echo M-files during execution format Control the display format for output home Move cursor to upper left corner of Command Window more Control paged output for the Command Window Working with Files and the Operating Environment beep Produce a beep sound cd Change working directory checkin Check file into source control system checkout Check file out of source control system cmopts Get name of source control system, and PVCS project filename copyfile Copy file customverctrl Allow custom source control system delete Delete files or graphics objects diary Save session to a disk file dir Display a directory listing dos Execute a DOS command and return the result edit Edit an M-file fileparts Get filename parts filebrowser Display Current Directory browser, for viewing files fullfile Build full filename from parts info Display contact information or toolbox Readme files inmem Functions in memory 1-ix ls List directory on UNIX matlabroot Get root directory of MATLAB installation mkdir Make new directory open Open files based on extension pwd Display current directory tempdir Return the name of the system’s temporary directory tempname Unique name for temporary file undocheckout Undo previous checkout from source control system unix Execute a UNIX command and return the result ! Execute operating system command Starting and Quitting MATLAB finish MATLAB termination M-file exit Terminate MATLAB matlab Start MATLAB (UNIX systems only) matlabrc MATLAB startup M-file quit Terminate MATLAB startup MATLAB startup M-file Operators and Special Characters + Plus - Minus * Matrix multiplication .* Array multiplication ^ Matrix power .^ Array power kron Kronecker tensor product \ Backslash or left division / Slash or right division ./ and .\ Array division, right and left : Colon ( ) Parentheses [ ] Brackets {} Curly braces . Decimal point ... Continuation , Comma ; Semicolon % Comment ! Exclamation point 1-x ' Transpose and quote .' Nonconjugated transpose = Assignment == Equality < > Relational operators & Logical AND | Logical OR ~ Logical NOT xor Logical EXCLUSIVE OR Logical Functions all Test to determine if all elements are nonzero any Test for any nonzeros exist Check if a variable or file exists find Find indices and values of nonzero elements is* Detect state isa Detect an object of a given class iskeyword Test if string is a MATLAB keyword isvarname Test if string is a valid variable name logical Convert numeric values to logical mislocked True if M-file cannot be cleared Language Constructs and Debugging MATLAB as a Programming Language builtin Execute builtin function from overloaded method eval Interpret strings containing MATLAB expressions evalc Evaluate MATLAB expression with capture evalin Evaluate expression in workspace feval Function evaluation function Function M-files global Define global variables nargchk Check number of input arguments persistent Define persistent variable script Script M-files Control Flow break Terminate execution of for loop or while loop 1-xi case Case switch catch Begin catch block continue Pass control to the next iteration of for or while loop else Conditionally