Freemat V4.0 Documentation
Total Page:16
File Type:pdf, Size:1020Kb
FreeMat v4.0 Documentation Samit Basu October 4, 2009 2 Contents 1 Introduction and Getting Started 39 1.1 INSTALL Installing FreeMat . 39 1.1.1 General Instructions . 39 1.1.2 Linux . 39 1.1.3 Windows . 40 1.1.4 Mac OS X . 40 1.1.5 Source Code . 40 2 Variables and Arrays 41 2.1 CELL Cell Array Definitions . 41 2.1.1 Usage . 41 2.1.2 Examples . 41 2.2 Function Handles . 42 2.2.1 Usage . 42 2.3 GLOBAL Global Variables . 42 2.3.1 Usage . 42 2.3.2 Example . 42 2.4 INDEXING Indexing Expressions . 43 2.4.1 Usage . 43 2.4.2 Array Indexing . 43 2.4.3 Cell Indexing . 46 2.4.4 Structure Indexing . 47 2.4.5 Complex Indexing . 49 2.5 MATRIX Matrix Definitions . 49 2.5.1 Usage . 49 2.5.2 Examples . 49 2.6 PERSISTENT Persistent Variables . 51 2.6.1 Usage . 51 2.6.2 Example . 51 2.7 STRUCT Structure Array Constructor . 51 2.7.1 Usage . 51 2.7.2 Example . 52 3 4 CONTENTS 3 Functions and Scripts 55 3.1 ANONYMOUS Anonymous Functions . 55 3.1.1 Usage . 55 3.1.2 Examples . 55 3.2 FUNCTION Function Declarations . 56 3.2.1 Usage . 56 3.2.2 Examples . 57 3.3 KEYWORDS Function Keywords . 60 3.3.1 Usage . 60 3.3.2 Example . 60 3.4 NARGIN Number of Input Arguments . 61 3.4.1 Usage . 61 3.4.2 Example . 61 3.5 NARGOUT Number of Output Arguments . 62 3.5.1 Usage . 62 3.5.2 Example . 62 3.6 SCRIPT Script Files . 63 3.6.1 Usage . 63 3.6.2 Example . 63 3.7 SPECIAL Special Calling Syntax . 64 3.7.1 Usage . 64 3.7.2 Example . 64 3.8 VARARGIN Variable Input Arguments . 65 3.8.1 Usage . 65 3.8.2 Example . 65 3.9 VARARGOUT Variable Output Arguments . 66 3.9.1 Usage . 66 3.9.2 Example . 66 4 Mathematical Operators 67 4.1 COLON Index Generation Operator . 67 4.1.1 Usage . 67 4.1.2 Function Internals . 67 4.1.3 Examples . 69 4.2 COMPARISONOPS Array Comparison Operators . 69 4.2.1 Usage . 69 4.2.2 Examples . 70 4.3 DOTLEFTDIVIDE Element-wise Left-Division Operator . 71 4.3.1 Usage . 71 4.3.2 Function Internals . 71 4.3.3 Examples . 71 4.4 DOTPOWER Element-wise Power Operator . 73 4.4.1 Usage . 73 4.4.2 Function Internals . 73 4.4.3 Examples . 73 4.5 DOTRIGHTDIVIDE Element-wise Right-Division Operator . 74 CONTENTS 5 4.5.1 Usage . 74 4.5.2 Function Internals . 75 4.5.3 Examples . 75 4.6 DOTTIMES Element-wise Multiplication Operator . 76 4.6.1 Usage . 76 4.6.2 Function Internals . 77 4.6.3 Examples . 77 4.7 HERMITIAN Matrix Hermitian (Conjugate Transpose) Operator . 78 4.7.1 Usage . 78 4.7.2 Function Internals . 78 4.7.3 Examples . 78 4.8 LEFTDIVIDE Matrix Equation Solver/Divide Operator . 79 4.8.1 Usage . 79 4.8.2 Function Internals . 79 4.8.3 Examples . 80 4.9 LOGICALOPS Logical Array Operators . 81 4.9.1 Usage . 81 4.9.2 Examples . 82 4.10 MATRIXPOWER Matrix Power Operator . 83 4.10.1 Usage . 83 4.10.2 Function Internals . 84 4.10.3 Examples ..