1. Trang chủ
  2. » Giáo án - Bài giảng

Giáo trình Matlab: matlab

896 156 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 896
Dung lượng 5,65 MB

Nội dung

MATLAB® Programming Fundamentals CuuDuongThanCong.com https://fb.com/tailieudientucntt How to Contact The MathWorks Web Newsgroup www.mathworks.com/contact_TS.html Technical Support www.mathworks.com comp.soft-sys.matlab suggest@mathworks.com bugs@mathworks.com doc@mathworks.com service@mathworks.com info@mathworks.com 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 Apple Hill Drive Natick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web site MATLAB Programming Fundamentals © COPYRIGHT 1984–2008 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 www.mathworks.com/trademarks 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 www.mathworks.com/patents for more information CuuDuongThanCong.com https://fb.com/tailieudientucntt Revision History June 2004 October 2004 March 2005 June 2005 September 2005 March 2006 September 2006 March 2007 September 2007 March 2008 October 2008 CuuDuongThanCong.com First printing Online only Online only Second printing Online only Online only Online only Online only Online only Online only Online only New for MATLAB 7.0 (Release 14) Revised for MATLAB 7.0.1 (Release 14SP1) Revised for MATLAB 7.0.4 (Release 14SP2) Minor revision for MATLAB 7.0.4 Revised for MATLAB 7.1 (Release 14SP3) Revised for MATLAB 7.2 (Release 2006a) Revised for MATLAB 7.3 (Release 2006b) Revised for MATLAB 7.4 (Release 2007a) Revised for Version 7.5 (Release 2007b) Revised for Version 7.6 (Release 2008a) Revised for Version 7.7 (Release 2008b) https://fb.com/tailieudientucntt CuuDuongThanCong.com https://fb.com/tailieudientucntt Contents Matrices and Arrays Creating and Concatenating Matrices Overview Constructing a Simple Matrix Specialized Matrix Functions Concatenating Matrices Matrix Concatenation Functions Generating a Numeric Sequence Combining Unlike Classes 1-2 1-2 1-3 1-4 1-7 1-8 1-10 1-12 Matrix Indexing Accessing Single Elements Linear Indexing Functions That Control Indexing Style Accessing Multiple Elements Using Logicals in Array Indexing Single-Colon Indexing with Different Array Types Indexing on Assignment 1-17 1-17 1-18 1-18 1-19 1-21 1-25 1-25 Getting Information About a Matrix Dimensions of the Matrix Classes Used in the Matrix Data Structures Used in the Matrix 1-27 1-27 1-28 1-29 Resizing and Reshaping Matrices Expanding the Size of a Matrix Diminishing the Size of a Matrix Reshaping a Matrix Preallocating Memory 1-30 1-30 1-34 1-35 1-37 Shifting and Sorting Matrices Shift and Sort Functions Shifting the Location of Matrix Elements Sorting the Data in Each Column Sorting the Data in Each Row 1-40 1-40 1-40 1-42 1-42 v CuuDuongThanCong.com https://fb.com/tailieudientucntt Sorting Row Vectors 1-43 Operating on Diagonal Matrices Diagonal Matrix Functions Constructing a Matrix from a Diagonal Vector Returning a Triangular Portion of a Matrix Concatenating Matrices Diagonally 1-45 1-45 1-45 1-46 1-46 Empty Matrices, Scalars, and Vectors Overview The Empty Matrix Scalars Vectors 1-47 1-47 1-48 1-50 1-51 Full and Sparse Matrices Overview Sparse Matrix Functions 1-53 1-53 1-53 Multidimensional Arrays Overview Creating Multidimensional Arrays Accessing Multidimensional Array Properties Indexing Multidimensional Arrays Reshaping Multidimensional Arrays Permuting Array Dimensions Computing with Multidimensional Arrays Organizing Data in Multidimensional Arrays Multidimensional Cell Arrays Multidimensional Structure Arrays 1-55 1-55 1-57 1-61 1-61 1-65 1-67 1-69 1-70 1-72 1-73 Summary of Matrix and Array Functions 1-75 Classes (Data Types) Overview of MATLAB Classes Fundamental Classes How to Use the Different Classes vi Contents CuuDuongThanCong.com https://fb.com/tailieudientucntt 2-2 2-2 2-3 Numeric Classes Overview Integers Floating-Point Numbers Complex Numbers Infinity and NaN Identifying Numeric Classes Display Format for Numeric Values Function Summary 2-5 2-5 2-5 2-13 2-23 2-24 2-26 2-26 2-28 Logical Classes Overview of Logical Classes Identifying Logical Arrays Functions that Return a Logical Result Using Logical Arrays in Conditional Statements Using Logical Arrays in Indexing 2-32 2-32 2-33 2-34 2-36 2-37 Characters and Strings Creating Character Arrays Cell Arrays of Strings Formatting Strings String Comparisons Searching and Replacing Converting from Numeric to String Converting from String to Numeric Function Summary 2-38 2-38 2-43 2-45 2-58 2-61 2-62 2-64 2-66 Structures Overview Building Structure Arrays Accessing Data in Structure Arrays Using Dynamic Field Names Finding the Size of Structure Arrays Adding Fields to Structures Deleting Fields from Structures Applying Functions and Operators Writing Functions to Operate on Structures Organizing Data in Structure Arrays Nesting Structures Function Summary 2-69 2-69 2-70 2-73 2-75 2-76 2-77 2-78 2-78 2-79 2-80 2-86 2-87 Cell Arrays 2-88 vii CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview Cell Array Operators Creating a Cell Array Referencing Cells of a Cell Array Deleting Cells Reshaping Cell Arrays Replacing Lists of Variables with Cell Arrays Applying Functions and Operators Organizing Data in Cell Arrays Nesting Cell Arrays Converting Between Cell and Numeric Arrays Cell Arrays of Structures Function Summary 2-88 2-89 2-90 2-94 2-101 2-101 2-102 2-103 2-104 2-105 2-107 2-108 2-109 Function Handles Overview Creating a Function Handle Calling a Function Using Its Handle Handling Values Returned From a Call Applications of Function Handles Saving and Loading Function Handles Advanced Operations on Function Handles Functions That Operate on Function Handles 2-110 2-110 2-110 2-113 2-114 2-115 2-120 2-121 2-127 Map Containers Overview of the Map Data Structure Description of the Map Class Creating a Map Object Examining the Contents of the Map Reading and Writing Using a Key Index Modifying Keys and Values in the Map Mapping to Different Value Types Methods Summary 2-128 2-128 2-129 2-131 2-134 2-135 2-138 2-140 2-142 Definìng Your Own Classes 2-143 Sun Java Classes 2-144 viii Contents CuuDuongThanCong.com https://fb.com/tailieudientucntt Basic Program Components MATLAB Commands Basic Command Syntax Entering More Than One Command on a Line Assigning to Multiple Outputs Commands that Call MATLAB Functions 3-2 3-2 3-3 3-3 3-5 Expressions String Evaluation Shell Escape Functions 3-6 3-6 3-7 Variables Types of Variables Naming Variables Guidelines to Using Variables Scope of a Variable Lifetime of a Variable 3-9 3-9 3-13 3-17 3-17 3-19 Keywords 3-20 Special Values 3-21 Operators Arithmetic Operators Relational Operators Logical Operators Operator Precedence 3-23 3-23 3-24 3-25 3-32 Comma-Separated Lists What Is a Comma-Separated List? Generating a Comma-Separated List Assigning Output from a Comma-Separated List Assigning to a Comma-Separated List How to Use the Comma-Separated Lists Fast Fourier Transform Example 3-34 3-34 3-34 3-36 3-37 3-38 3-40 Program Control Statements Conditional Control — if, switch 3-42 3-42 ix CuuDuongThanCong.com https://fb.com/tailieudientucntt Loop Control — for, while, continue, break Error Control — try, catch Program Termination — return 3-46 3-49 3-50 Dates and Times Overview Types of Date Formats Conversions Between Date Formats Date String Formats Output Formats Current Date and Time Function Summary 3-51 3-51 3-51 3-53 3-54 3-55 3-56 3-57 Regular Expressions 3-59 Overview 3-59 MATLAB Regular Expression Functions 3-60 Character Classes 3-61 Character Representation 3-64 Grouping Operators 3-65 Nonmatching Operators 3-67 Positional Operators 3-67 Lookaround Operators 3-68 Quantifiers 3-74 Tokens 3-77 Named Capture 3-82 Conditional Expressions 3-84 Dynamic Regular Expressions 3-87 String Replacement 3-96 Handling Multiple Strings 3-98 Operator Summary 3-101 Symbol Reference Asterisk — * At — @ Colon — : Comma — , Curly Braces — { } Dot — Dot-Dot — Dot-Dot-Dot (Ellipsis) — Dot-Parentheses — ( ) Exclamation Point — ! Parentheses — ( ) x Contents CuuDuongThanCong.com https://fb.com/tailieudientucntt 3-108 3-108 3-109 3-110 3-111 3-112 3-112 3-113 3-113 3-114 3-115 3-115 Index fopen 7-105 failing 7-106 for 2-107 example 3-46 indexing 3-47 nested 3-46 syntax 3-46 format for numeric values 2-26 formatting strings 2-45 field width 2-53 flags 2-53 format operator 2-49 precision 2-52 setting field width 2-55 to 2-56 setting precision 2-55 to 2-56 subtype 2-52 using identifiers 2-56 value identifiers 2-54 fprintf formatting strings 2-45 fread 7-107 frewind 7-109 fseek 7-109 ftell 7-109 FTP file operations 7-122 function calls memory requirements 12-6 function definition line for subfunction 5-33 in an M-file 4-8 syntax 4-9 function handles example 2-113 for nested functions 5-21 maximum name length 2-111 naming 2-111 operations on 2-127 overview of 2-110 function types overloaded 5-37 function workspace 4-20 functions applying to multidimensional structure arrays 1-74 to structure contents 2-78 applying to cell arrays 2-103 arguments passing variable number of 4-47 body 4-8 4-12 built-in 3-121 forcing a built-in call 3-122 identifying 3-122 calling command syntax 4-26 function syntax 4-28 Index-10 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index passing arguments 4-28 calling context 4-20 cell arrays 2-109 cell arrays of strings 2-44 changing indexing style 1-77 character arrays 2-67 clearing from memory 4-34 comments 4-8 comparing character arrays 2-67 complex number 2-30 computational, applying to structure fields 2-78 creating a matrix 1-75 creating arrays with 1-59 creating matrices 1-4 date and time 3-57 determining data type 1-76 example 4-21 executing function name string 3-7 finding matrix structure or shape 1-76 floating-point 2-29 for diagonal matrices 1-77 infinity 2-30 integer 2-29 logical array 2-35 M-file 3-120 matrix concatenation 1-8 modifying character arrays 2-67 modifying matrix shape 1-75 multidimensional arrays 1-78 multiple output arguments 4-10 naming conflict with variable names 3-14 NaN 2-30 numeric and string conversion 2-68 numeric to string conversion 2-62 output formatting 2-31 overloaded 3-122 primary 5-33 searching character arrays 2-67 shadowed 3-14 sorting and shifting 1-77 sparse matrix 1-53 storing as pseudocode 4-17 string to numeric conversion 2-64 structures 2-87 that determine data type 2-68 type identification 2-31 types of 4-21 anonymous 5-3 nested 5-16 overloaded 5-37 primary 5-15 private 5-35 subfunctions 5-33 fwrite 7-109 G global attributes HDF4 files 8-69 global variables 3-10 alternatives 3-12 creating 3-11 displaying 3-11 suggestions for use 3-11 graphics files getting information about 7-90 importing and exporting 7-90 greater than operator 3-24 greater than or equal to operator 3-24 growing an array 1-30 Index-11 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index growing cell array 1-31 1-33 growing structure arrays 1-31 1-33 H H1 line 4-8 4-11 and help command 4-8 and lookfor command 4-8 HDF Import Tool using 8-45 using subsetting options 8-50 HDF-EOS Earth Observing System 8-45 HDF4 8-45 closing a data set 8-79 closing a file 8-80 closing all open identifiers 8-81 closing data sets 8-72 creating a file 8-74 creating data sets 8-74 exporting in HDF4 format 8-66 importing data 8-63 importing subsets of data 8-48 listing all open identifiers 8-80 low-level functions overview 8-65 reading data 8-67 mapping HDF4 syntax to MATLAB syntax 8-66 MATLAB utility API 8-80 opening files 8-68 overview 8-45 reading data 8-71 reading data set metadata 8-70 reading data sets 8-70 reading global attributes 8-69 reading metadata 8-68 selecting data sets to import 8-47 specifying file access modes 8-68 using hdfinfo to import metadata 8-62 using high-level functions overview 8-62 using predefined attributes 8-78 using the HDF Import Tool 8-45 writing data 8-73 8-76 writing metadata 8-78 See also HDF5 HDF5 8-20 exporting data in HDF5 format 8-25 low-level functions mapping HDF5 data types to MATLAB data types 8-38 mapping HDF5 syntax to MATLAB syntax 8-36 reading and writing data 8-40 overview 8-20 using hdf5info to read metadata 8-20 using hdf5read to import data 8-24 using high-level functions 8-20 using low-level functions 8-35 See also HDF4 help and H1 line 4-8 M-file 4-11 help text 4-8 hexadecimal, converting from decimal 2-64 Index-12 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index Hierarchical Data Format See HDF4 See HDF5 hyperthreading 11-16 I if and empty arrays 3-43 example 3-42 nested 3-43 imaginary unit 3-21 Import Data option 7-11 import functions comparison of features 7-78 Import Wizard importing binary data 7-11 overview 7-4 importing ASCII data 7-76 HDF4 data 8-62 from the command line 8-65 selecting HDF4 data sets 8-47 subsets of HDF4 data 8-48 importing files overview 7-2 indexing for loops 3-47 multidimensional arrays 1-61 nested cell arrays 2-106 nested structure arrays 2-86 structures within cell arrays 2-108 within structure fields 2-75 indices, how MATLAB calculates 1-64 Inf 3-21 infinity 2-24 functions 2-30 represented in MATLAB 3-21 inputParser class arguments that default 4-56 building the schema 4-51 case-sensitive matching 4-58 constructor 4-51 defined 4-50 handling unmatched arguments 4-57 method summary 4-59 parsing parameters 4-53 passing arguments in a structure 4-55 property summary 4-60 integer class 7-114 integer functions 2-29 integers 2-5 creating 2-6 largest system can represent 3-21 smallest system can represent 3-21 Internet functions 7-117 intmax 3-21 intmin 3-21 inverse permutation of array dimensions 1-68 ipermute 1-68 J java classes 2-144 K keywords 3-20 checking for 13-26 L large data sets memory usage in array storage 12-3 memory usage in function calls 12-16 less than operator 3-24 less than or equal to operator 3-24 load 12-12 local variables 3-9 Index-13 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index logical array functions 2-35 logical classes 2-32 logical data types 2-32 logical expressions and subscripting 3-29 logical operators 3-25 bit-wise 3-30 elementwise 3-26 short-circuit 3-31 long 7-108 long integer 7-108 lookfor 4-8 4-11 and H1 line 4-8 loops for 3-46 while 3-47 M M-file functions identifying 3-120 M-files comments 4-12 contents 4-8 creating in MATLAB directory 4-14 creating with text editor 4-13 kinds 4-7 naming 4-7 operating on structures 2-79 overview 4-8 primary function 5-15 subfunction 5-33 superseding existing names 5-34 Map class 2-128 to 2-129 constructing objects of 2-131 methods 2-131 properties 2-130 Map objects 2-128 concatenating 2-137 constructing 2-131 examining contents of 2-134 mapping to different types 2-140 methods summary 2-142 modifying a copy of 2-140 modifying keys 2-139 modifying values 2-139 reading from 2-135 removing keys and values 2-138 writing to 2-136 mapping memory See memory mapping MATLAB programming M-files 4-7 scripts 4-19 version 3-21 matrices accessing multiple elements 1-19 accessing single elements 1-17 concatenating 1-7 concatenating diagonally 1-46 constructing a matrix operations constructing 1-3 creating 1-2 data structure query 1-29 data type query 1-28 deleting rows and columns 1-34 diagonal 1-45 double-precision 2-5 empty 1-48 expanding 1-30 flipping 1-37 for loop index 3-47 functions changing indexing style 1-77 creating a matrix 1-75 determining data type 1-76 finding matrix structure or shape 1-76 Index-14 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index modifying matrix shape 1-75 sorting and shifting 1-77 functions for creating 1-4 functions for diagonals 1-77 getting dimensions of 1-27 linear indexing 1-18 reshaping 1-35 rotating 1-37 scalar 1-50 See also matrices 3-47 shifting 1-40 single-precision 2-5 sorting column data 1-42 sorting row data 1-42 sorting row vectors 1-43 transposing 1-36 vectors 1-51 matrix operations concatenating matrices 1-7 creating matrices 1-2 mean 1-69 memory function workspace 4-20 making efficient use of 12-2 management 12-12 Out of Memory message 12-22 memory mapping demonstration 7-60 memmapfile class class constructor 7-30 class methods 7-57 class properties 7-28 defined 7-28 Filename property 7-33 Format property 7-35 Offset property 7-34 Repeat property 7-42 supported formats 7-41 Writable property 7-43 overview 7-24 benefits of 7-25 byte ordering 7-27 limitations of 7-26 when to use 7-27 reading from file 7-44 removing map 7-59 selecting file to map 7-33 setting access privileges 7-43 setting extent of map 7-42 setting start of map 7-34 specifying classes in file 7-35 supported classes 7-41 writing to file 7-49 memory requirements array headers 12-5 for array allocation 12-2 for complex arrays 12-7 for copying arrays 12-3 for creating and modifying arrays 12-2 for handling variables in 12-2 for numeric arrays 12-7 for passing arguments 12-6 for sparse matrices 12-7 message identifiers using with warnings 9-26 methods determining which is called 4-37 multidimensional arrays applying functions 1-69 element-by-element functions 1-69 matrix functions 1-69 vector functions 1-69 cell arrays 1-72 computations on 1-69 creating 1-57 at the command line 1-57 with functions 1-59 Index-15 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index with the cat function 1-59 extending 1-58 format 1-61 indexing 1-61 avoiding ambiguity 1-65 with the colon operator 1-62 number of dimensions 1-61 organizing data 1-70 permuting dimensions 1-67 removing singleton dimensions 1-66 reshaping 1-65 size of 1-61 storage 1-61 structure arrays 1-73 applying functions 1-74 subscripts 1-56 multiple conditions for switch 3-45 multiplication operators matrix multiplication 3-23 multiplication 3-23 multiprocessing explicit 11-17 implicit 11-14 overview of 11-13 multithreaded computation 11-14 enabling 11-15 number of threads 11-17 multithreading BLAS 11-14 N names structure fields 2-71 superseding 5-34 naming conflicts 3-14 NaN 2-25 3-21 functions 2-30 logical operations on 2-25 nargin 4-45 checking input arguments 4-45 in nested functions 4-60 nargout 4-45 checking output arguments 4-45 in nested functions 4-60 ndgrid 1-78 ndims 1-61 nested functions 5-16 creating 5-16 example — creating a function handle 5-27 example — function-generating functions 5-29 passing optional arguments 4-60 separate variable instances 5-25 using function handles with 5-21 variable scope in 5-19 nesting cell arrays 2-105 for loops 3-46 if statements 3-43 structures 2-86 netCDF mapping netCDF syntax to MATLAB syntax 8-9 MATLAB support 8-8 reading and writing data 8-10 Network Common Data Form see netCDF 8-8 newlines in string arrays 2-60 not (M-file function equivalent for ~) 3-27 not a number (NaN) 2-25 not equal to operator 3-24 Not-a-Number 3-21 now 3-56 number of arguments 4-45 numbers date 3-52 time 3-52 Index-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index numeric arrays memory requirements 12-7 numeric classes 2-5 conversion functions 2-68 converting to char 2-62 setting display format 2-26 numeric data types 2-5 conversion functions 2-68 setting display format 2-26 numeric to string conversion functions 2-62 O objects definitions of 6-2 key concepts 6-8 offsets for indexing 1-64 online help 4-11 opening files failing 7-106 HDF4 files 8-68 permissions 7-105 using low-level functions 7-105 operator precedence 3-32 overriding 3-33 operators addition 3-23 applying to cell arrays 2-103 applying to structure fields 2-78 arithmetic 3-23 categories 3-23 colon 3-23 complex conjugate transpose 3-23 deletion 1-34 equal to 3-24 greater than 3-24 greater than or equal to 3-24 left division 3-23 less than 3-24 less than or equal to 3-24 logical 3-25 bit-wise 3-30 elementwise 3-26 short-circuit 3-31 matrix left division 3-23 matrix multiplication 3-23 matrix power 3-23 matrix right division 3-23 multiplication 3-23 not equal to 3-24 power 3-23 relational 3-24 right division 3-23 subtraction 3-23 transpose 3-23 unary minus 3-23 unary plus 3-23 optimization preallocation, array 11-7 vectorization 11-4 or (M-file function equivalent for |) 3-27 organizing data cell arrays 2-104 multidimensional arrays 1-70 structure arrays 2-80 Index-17 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index Out of Memory message 12-22 output arguments 4-10 order of 4-47 output formatting functions 2-31 overloaded functions 3-122 5-37 P pack 12-12 packages use in references 6-11 page subscripts 1-56 parentheses for input arguments 4-10 overriding operator precedence with 3-33 parsing input arguments 4-50 Paste Special option 7-11 pcode 4-17 percent sign (comments) 4-12 performance analyzing 11-2 permission strings 7-105 permute 1-67 permuting array dimensions 1-67 inverse 1-68 persistent variables 3-12 initializing 3-13 pi 3-21 plane organization for structures 2-82 polar 4-20 power operators matrix power 3-23 power 3-23 preallocation arrays 11-7 cell array 11-8 precedence of class 1-12 of data types 1-12 operator 3-32 overriding 3-33 precision char 7-108 classes 7-108 double 7-108 float 7-108 long 7-108 short 7-108 single 7-108 uchar 7-108 primary functions 5-15 private directory 5-35 private functions 5-35 precedence of when calling 4-36 program control break 3-48 case 3-44 catch 3-49 conditional control 3-42 continue 3-48 else 3-42 elseif 3-42 error control 3-49 for 3-46 if 3-42 loop control 3-46 otherwise 3-44 program termination 3-50 return 3-50 switch 3-44 try 3-49 while 3-47 programs running external 3-7 pseudocode 4-17 Q quit 12-12 Index-18 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index R randn 1-59 reading HDF4 data 8-62 from the command line 8-65 selecting HDF4 data sets 8-47 subsets of HDF4 data 8-48 realmax 3-21 realmin 3-21 regexp 3-60 regexpi 3-60 regexprep 3-60 regexptranslate 3-60 regular expression metacharacters character classes match alphanumeric character (\w) 3-63 match any character (period) 3-62 match any characters but these ([^c1c2c3]) 3-61 match any of these characters ([c1c2c3]) 3-63 match characters in this range ([c1-c2]) 3-63 match digit character (\d) 3-64 match nonalphanumeric character (\W) 3-62 match nondigit character (\D) 3-62 match nonwhitespace character (\S) 3-61 match whitespace character (\s) 3-63 character representation alarm character (\a) 3-64 backslash character (\\) 3-64 3-102 backspace character (\b) 3-64 carriage return character (\r) 3-64 dollar sign (\$) 3-64 3-102 form feed character (\f) 3-64 hexadecimal character (\x) 3-64 horizontal tab character (\t) 3-64 literal character (\char) 3-64 new line character (\n) 3-64 octal character (\o) 3-64 vertical tab character (\v) 3-64 conditional operators if condition, match expr ((?(condition)expr)) 3-84 3-106 dynamic expressions pattern matching functions 3-90 pattern matching scripts 3-91 replacement expressions 3-90 string replacement functions 3-94 logical operators atomic group ((?>expr)) 3-65 comment (?#expr) 3-67 grouping and capture (expr) 3-65 grouping only (?:expr) 3-66 match exact word (\) 3-68 match expr1 or expr2 (expr1|expr2) 3-66 match if expression begins string (^expr) 3-68 match if expression begins word (\) 3-68 noncapturing group ((?:expr)) 3-65 lookaround operators match expr1, if followed by expr2 (expr1(?=expr2)) 3-70 match expr1, if not followed by expr2 (expr1(?!expr2)) 3-71 match expr2, if not preceded by expr1 (expr1(?expr)) 3-82 create unnamed token ((expr)) 3-78 give name to token ((?expr))) 3-82 if token, match expr1, else expr2 ((?(token)expr1|expr2)) 3-84 match named token (\k) 3-82 match Nth token (\N) 3-78 replace Nth token ($N) 3-78 replace Nth token (N) 3-78 replace with named token (?) 3-83 regular expressions character classes 3-61 character representation 3-64 conditional expressions 3-84 dynamic expressions 3-87 example 3-88 functions regexp 3-60 regexpi 3-60 regexprep 3-60 regexptranslate 3-60 introduction 3-59 logical operators 3-65 lookaround operators 3-67 used in logical statements 3-73 multiple strings finding a single pattern 3-98 finding multiple patterns 3-99 matching 3-98 replacing 3-100 quantifiers 3-74 lazy 3-77 tokens 3-77 example 3-79 example 3-80 introduction 3-78 named capture 3-82 operators 3-78 use in replacement string 3-82 relational operators 3-24 empty arrays 3-25 strings 2-60 removing cells from cell array 2-101 fields from structure arrays 2-78 singleton dimensions 1-66 replacing substring within string 2-61 repmap 1-59 reshape 1-65 2-101 reshaping cell arrays 2-101 multidimensional arrays 1-65 reshaping matrices 1-35 rmfield 2-78 rotating matrices 1-37 S save 12-12 scalar and relational operators 2-60 expansion 3-24 string 2-60 scalars 1-50 scheduling program execution using timers 10-2 Index-20 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index scripts 4-7 example 4-19 executing 4-20 search path M-files on 5-34 shell escape functions 3-7 shiftdim 1-78 shifting matrix elements 1-40 short 7-108 short integer 7-108 short-circuiting in conditional expressions 3-28 operators 3-31 sin 1-69 single precision 7-108 single-precision matrix 2-5 size 2-76 structure arrays 2-76 structure fields 2-76 smallest value system can represent 3-21 sorting matrix column data 1-42 sorting matrix row data 1-42 sorting matrix row vectors 1-43 (space) character for separating array row elements 3-118 for separating function return values 3-118 sparse matrices memory requirements 12-7 sparse matrix functions 1-53 sprintf 7-115 formatting strings 2-45 square brackets for output arguments 4-10 squeeze with multidimensional arguments 1-70 sscanf 7-114 starting timers 10-10 statements conditional 4-45 stopping timers 10-10 strcmp 2-58 string to numeric conversion functions 2-64 strings 2-38 comparing 2-58 converting to numeric 2-64 functions to create 2-66 searching and replacing 2-61 strings, cell arrays of 2-43 strings, formatting 2-45 escape characters 2-47 field width 2-53 flags 2-53 format operator 2-49 precision 2-52 setting field width 2-55 to 2-56 setting precision 2-55 to 2-56 subtype 2-52 using identifiers 2-56 value identifiers 2-54 structs 2-71 for nested structures 2-86 structure arrays 2-69 accessing data 2-73 adding fields to 2-77 applying functions to 2-78 building 2-70 using structs 2-71 data organization 2-80 deleting fields 2-78 dynamic field names 2-75 element-by-element organization 2-83 expanding 2-70 fields 2-69 assigning data to 2-70 growing 1-31 1-33 indexing nested structures 2-86 Index-21 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index within fields 2-75 multidimensional 1-73 applying functions 1-74 nesting 2-86 obtaining field names 2-71 organizing data 2-80 example 2-84 plane organization 2-82 size 2-76 subarrays, accessing 2-74 subscripting 2-70 within cell arrays 2-108 writing M-files for 2-79 example 2-79 structures field names dynamic 2-75 functions 2-87 subfunctions 5-33 accessing 5-34 creating 5-33 debugging 5-34 definition line 5-33 precedence of 4-35 subscripting how MATLAB calculates indices 1-64 multidimensional arrays 1-56 page 1-56 structure arrays 2-70 with logical expression 3-29 with the find function 3-29 substring within a string 2-61 subtraction operator 3-23 sum 1-69 superseding existing M-file names 5-34 symbols 3-108 asterisk * 3-108 at sign @ 3-109 colon : 3-110 comma , 3-111 curly braces { } 3-112 dot 3-112 dot-dot 3-113 dot-dot-dot 3-113 dot-parentheses ( ) 3-114 exclamation point ! 3-115 parentheses ( ) 3-115 percent % 3-115 percent-brace %{ and %} 3-116 semicolon ; 3-116 single quotes ' 3-117 space character 3-118 square brackets [ ] 3-119 T tabs in string arrays 2-60 tempdir 7-107 tempname 7-107 temporary files creating 7-107 text files reading 7-112 tic and toc versus cputime 11-3 time numbers 3-52 time and date functions 3-57 switch case groupings 3-44 example 3-45 multiple conditions 3-45 Index-22 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index timer objects blocking the command line 10-12 callback functions 10-14 creating 10-5 deleting 10-5 execution modes 10-19 finding all existing timers 10-24 naming convention 10-6 overview 10-2 properties 10-7 starting 10-10 stopping 10-10 timers starting and stopping 10-10 using 10-2 times and dates 3-51 tips, programming additional information 13-55 command and function syntax 13-3 debugging 13-21 demos 13-54 development environment 13-10 evaluating expressions 13-32 files and filenames 13-45 function arguments 13-15 help 13-6 input/output 13-48 M-file functions 13-12 MATLAB path 13-34 operating system compatibility 13-52 program control 13-38 program development 13-18 save and load 13-42 starting MATLAB 13-51 strings 13-29 variables 13-25 token in string 2-62 tokens regular expressions 3-77 tolerance 3-21 transpose 1-68 transpose operator 3-23 transposing matrices 1-36 trigonometric functions 1-69 type identification functions 2-31 U uchar class 7-108 unary minus operator 3-23 unary plus operator 3-23 V value class 7-108 largest system can represent 3-21 varargin 2-103 4-48 in argument list 4-49 in nested functions 4-60 unpacking contents 4-48 varargout 4-48 in argument list 4-49 in nested functions 4-60 packing contents 4-48 variables global 3-10 alternatives 3-12 creating 3-11 displaying 3-11 recommendations 3-18 suggestions for use 3-11 in evaluation statements 3-16 lifetime of 3-19 loaded from a MAT-file 3-15 local 3-9 naming 3-13 conflict with function names 3-14 persistent 3-12 Index-23 CuuDuongThanCong.com https://fb.com/tailieudientucntt Index initializing 3-13 replacing list with a cell array 2-102 scope 3-17 in nested functions 3-19 storage in memory 12-2 usage guidelines 3-17 vector of dates 3-54 preallocation 11-7 vectorization 11-4 example 11-4 replacing for vectorization 3-46 vectors 1-51 verbose mode warning control 9-31 version 3-21 obtaining 3-21 W warning formatting strings 2-45 warning control 9-24 backtrace, verbose modes 9-31 saving and restoring state 9-30 warning control statements message identifiers 9-26 output from 9-28 output structure array 9-29 warnings debugging 9-34 identifying 9-23 syntax 9-25 warning control statements 9-26 warning states 9-26 Web content access 7-117 which 4-37 while empty arrays 3-48 example 3-47 syntax 3-47 white space finding in string 2-60 whos 1-61 interpreting memory use 12-12 wildcards, in filenames 3-109 workspace context 4-20 of individual functions 4-20 writing ASCII data 7-85 HDF4 data 8-76 in HDF4 format 8-66 in HDF5 format 8-25 Z zeros 1-59 Index-24 CuuDuongThanCong.com https://fb.com/tailieudientucntt ... for MATLAB 7.0 (Release 14) Revised for MATLAB 7.0.1 (Release 14SP1) Revised for MATLAB 7.0.4 (Release 14SP2) Minor revision for MATLAB 7.0.4 Revised for MATLAB 7.1 (Release 14SP3) Revised for MATLAB. .. Objects MATLAB Objects What Are Objects? Objects In the MATLAB Language Other Kinds of Objects Used by MATLAB. .. Starting MATLAB 13-51 Getting MATLAB to Start Up Faster 13-51 Operating System Compatibility Executing O/S Commands from MATLAB

Ngày đăng: 14/09/2020, 22:43

TỪ KHÓA LIÊN QUAN

w