Freemat V3.6 Documentation
Total Page:16
File Type:pdf, Size:1020Kb
FreeMat v3.6 Documentation Samit Basu November 16, 2008 2 Contents 1 Introduction and Getting Started 5 1.1 INSTALL Installing FreeMat . 5 1.1.1 General Instructions . 5 1.1.2 Linux . 5 1.1.3 Windows . 6 1.1.4 Mac OS X . 6 1.1.5 Source Code . 6 2 Variables and Arrays 7 2.1 CELL Cell Array Definitions . 7 2.1.1 Usage . 7 2.1.2 Examples . 7 2.2 Function Handles . 8 2.2.1 Usage . 8 2.3 GLOBAL Global Variables . 8 2.3.1 Usage . 8 2.3.2 Example . 9 2.4 INDEXING Indexing Expressions . 9 2.4.1 Usage . 9 2.4.2 Array Indexing . 9 2.4.3 Cell Indexing . 13 2.4.4 Structure Indexing . 14 2.4.5 Complex Indexing . 16 2.5 MATRIX Matrix Definitions . 17 2.5.1 Usage . 17 2.5.2 Examples . 17 2.6 PERSISTENT Persistent Variables . 19 2.6.1 Usage . 19 2.6.2 Example . 19 2.7 STRING String Arrays . 20 2.7.1 Usage . 20 2.8 STRUCT Structure Array Constructor . 22 2.8.1 Usage . 22 2.8.2 Example . 22 3 4 CONTENTS 3 Functions and Scripts 25 3.1 ANONYMOUS Anonymous Functions . 25 3.1.1 Usage . 25 3.1.2 Examples . 25 3.2 FUNCTION Function Declarations . 26 3.2.1 Usage . 26 3.2.2 Examples . 28 3.3 KEYWORDS Function Keywords . 30 3.3.1 Usage . 30 3.3.2 Example . 31 3.4 NARGIN Number of Input Arguments . 32 3.4.1 Usage . 32 3.4.2 Example . 32 3.5 NARGOUT Number of Output Arguments . 33 3.5.1 Usage . 33 3.5.2 Example . 33 3.6 SCRIPT Script Files . 34 3.6.1 Usage . 34 3.6.2 Example . 35 3.7 SPECIAL Special Calling Syntax . 35 3.7.1 Usage . 35 3.7.2 Example . 36 3.8 VARARGIN Variable Input Arguments . 36 3.8.1 Usage . 36 3.8.2 Example . 36 3.9 VARARGOUT Variable Output Arguments . 37 3.9.1 Usage . 37 3.9.2 Example . 37 4 Mathematical Operators 39 4.1 COLON Index Generation Operator . 39 4.1.1 Usage . 39 4.1.2 Function Internals . 39 4.1.3 Examples . 41 4.2 COMPARISONOPS Array Comparison Operators . 42 4.2.1 Usage . 42 4.2.2 Examples . 42 4.3 DOTLEFTDIVIDE Element-wise Left-Division Operator . 43 4.3.1 Usage . 43 4.3.2 Function Internals . 44 4.3.3 Examples . 44 4.4 DOTPOWER Element-wise Power Operator . 46 4.4.1 Usage . 46 4.4.2 Function Internals . 46 4.4.3 Examples . 47 4.5 DOTRIGHTDIVIDE Element-wise Right-Division Operator . 48 CONTENTS 5 4.5.1 Usage . 48 4.5.2 Function Internals . 48 4.5.3 Examples . 49 4.6 DOTTIMES Element-wise Multiplication Operator . 51 4.6.1 Usage . 51 4.6.2 Function Internals . 51 4.6.3 Examples . 51 4.7 HERMITIAN Matrix Hermitian (Conjugate Transpose) Operator . 54 4.7.1 Usage . 54 4.7.2 Function Internals . 54 4.7.3 Examples . 54 4.8 LEFTDIVIDE Matrix Equation Solver/Divide Operator . 55 4.8.1 Usage . 55 4.8.2 Function Internals . 56 4.8.3 Examples . 56 4.9 LOGICALOPS Logical Array Operators . 58 4.9.1 Usage . 58 4.9.2 Examples . 59 4.10 MINUS Subtraction Operator . ..