Search
• Real Time Signals India

MATLAB and Simulink Work Together. When you use MATLAB and Simulink together, you combine textual and graphical programming to design your system in a simulation environment. Directly use the thousands of algorithms that are already in MATLAB.

## Introduction

What Is MATLAB?  The MATLAB System  Development Environment  Starting and Quitting MATLAB  MATLAB Desktop Desktop Tools

## Manipulating Matrices Matrices and Magic Squares

 Entering Matrices  sum, transpose, and diag  Subscripts  The Colon Operator  The magic Function Expressions  Variables  Numbers  Operators  Functions  Examples of Expressions Working with Matrices  Generating Matrices  The load Command .  M-Files  Concatenation  Deleting Rows and Columns Creating and Concatenating Matrices  Constructing a Simple Matrix  Specialized Matrix Functions  Concatenating Matrices  Matrix Concatenation Functions MATLAB & SIMULINK Page2  Generating a Numeric Sequence  Combining Unlike Data Types Matrix Indexing  Accessing Single Elements  Linear Indexing  Functions That Control Indexing Style  Accessing Multiple Elements  Logical Indexing  Indexing on Assignment More About Matrices and Arrays  Linear Algebra  Arrays  Multivariate Data  Scalar Expansion  Logical Subscripting  The find Function Getting Information About a Matrix  Dimensions of the Matrix  Data Types Used in the Matrix  Data Structures Used in the Matrix Resizing and Reshaping Matrices  Expanding the Size of a Matrix  Diminishing the Size of a Matrix  Reshaping a Matrix  Preallocating Memory 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  Sorting Row Vectors Operating on Diagonal Matrices  Constructing a Matrix from a Diagonal Vector  Returning a Triangular Portion of a Matrix  Concatenating Matrices Diagonally Empty Matrices, Scalars, and Vectors  The Empty Matrix  Scalars MATLAB & SIMULINK Page3  Vectors Full and Sparse Matrices  Sparse Matrix Functions 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 Summary of Matrix and Array Functions Controlling Command Window Input and Output  The format Command  Suppressing Output  Entering Long Command Lines  Command Line Editing

## Data Types Numeric Types  Integers  Floating-Point Numbers  Complex Numbers  Infinity and NaN  Identifying Numeric Types  Display Format for Numeric Values  Function Summary Logical Types  Creating a Logical Array  How Logical Arrays Are Used  Identifying Logical Arrays MATLAB & SIMULINK Page4 Characters and Strings  Creating Character Arrays  Cell Arrays of Strings  String Comparisons  Searching and Replacing  Converting from Numeric to String  Converting from String to Numeric  Function Summary Dates and Times  Types of Date Formats  Conversions Between Date Formats  Date String Formats  Output Formats  Current Date and Time  Function Summary Structures  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 Cell Arrays  Creating Cell Arrays  Obtaining Data from Cell Arrays  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 MATLAB & SIMULINK Page5  Function Summary Function Handles  Constructing and Invoking a Function Handle  Calling a Function Using Its Handle  Simple Function Handle Example

Programming with MATLAB

Basic Program Components Variables  Types of Variables  Naming Variables  Guidelines to Using Variables  Scope of a Variable  Lifetime of a Variable Keywords  Special Values Operators  Arithmetic Operators  Relational Operators  Logical Operators  Operator Precedence MATLAB Expressions  String Evaluation  Shell Escape Functions Regular Expressions  MATLAB Regular Expression Functions  Elements of an Expression  Character Classes  Character Representation  Logical Operators  Lookaround Operators  Quantifiers  Tokens  Handling Multiple Strings  Operator Summary Comma -Separated Lists MATLAB & SIMULINK Page6  Generating a List from a Cell Array  Generating a List from a Structure  How to Use the Comma-Separated List  Fast Fourier Transform Example Program Control Statements  Conditional Control — if, switch  Loop Control — for, while, continue, break  Error Control — try, catch  Program Termination — return MATLAB Functions  M-File Functions  Built-In Functions  Overloaded MATLAB Functions M-File Programming Program Development  Creating a Program  Getting the Bugs Out  Cleaning Up the Program  Improving Performance  Checking It In Working with M -Files  Types of M -Files  Basic Parts of an M -File  Creating a Simple M -File  Providing Help for Your Program  Creating P-Code Files M -File Scripts and Functions  M-File Scripts  M-File Functions  Types of Functions  Identifying Dependencies Function Arguments  Checking the Number of Input Arguments  Passing Variable Numbers of Arguments  Returning Output Arguments Function Handles  Constructing a Function Handle  Calling a Function Using Its Handle MATLAB & SIMULINK Page7  Functions That Operate on Function Handles  Additional Information on Function Handles Calling Functions  What Happens When You Call a Function  Determining Which Function Is Called  MATLAB Calling Syntax  Passing Certain Argument Types  Passing Arguments in Structures or Cell Arrays  Calling External Functions Types of Functions Overview of MATLAB Function Types Anonymous Functions  Constructing an Anonymous Function  Arrays of Anonymous Functions  Outputs from Anonymous Functions  Variables Used in the Expression  Examples of Anonymous Functions Primary M -File Functions Nested Functions  Writing Nested Functions  Calling Nested Functions  Variable Scope in Nested Functions  Using Function Handles with Nested Functions  Examples of Nested Functions Subfunctions  Calling Subfunctions  Accessing Help for a Subfunction

Graphics Basic Plotting

 Creating a Plot  Multiple Data Sets in One Graph  Specifying Line Styles and Colors  Plotting Lines and Markers  Imaginary and Complex Data  Adding Plots to an Existing Graph MATLAB & SIMULINK Page8  Figure Windows .  Multiple Plots in One Figure  Controlling the Axes  Axis Labels and Titles  Saving a Figure Editing Plots  Interactive Plot Editing  Using Functions to Edit Graphs  Using Plot Editing Mode  Using the Property Editor Mesh and Surface Plots  Visualizing Functions of Two Variables Images Printing Graphics Handle Graphics  Graphics Objects  Setting Object Properties  Finding the Handles of Existing Objects Graphics User Interfaces  Graphical User Interface Design Tools Animations  Erase Mode Method  Creating Movies

Data Import and Export Overview

## Checking for Errors with try -catch  Nested try -catch Blocks Handling and Recovering from an Error  Reporting an Error  Identifying the Cause  Regenerating an Error Message Identifiers  Identifier Format  Using Message Identifiers with lasterr Warnings  Reporting a Warning  Identifying the Cause Warning Control  Warning Statements  Warning Control Statements  Output from Control Statements  Saving and Restoring State  Debug, Backtrace, and Verbose Modes Debugging Errors and Warnings

Scheduling Program Execution with Timers Using a MATLAB Timer Object  Example: Displaying a Message Creating Timer Objects  Timer Object Naming Working with Timer Object Properties  Retrieving the Value of Timer Object Properties  Setting the Value of Timer Object Properties Starting and Stopping Timers  Starting a Timer  Starting a Timer at a Specified Time  Stopping Timer Objects  Blocking the MATLAB Command Line MATLAB & SIMULINK Page11 Creating and Executing Callback Functions  Associating Commands with Timer Object Events  Creating Callback Functions  Specifying the Value of Callback Function Properties Timer Object Execution Modes  Executing a Timer Callback Function Once  Executing a Timer Callback Function Multiple Times  Handling Callback Function Queuing Conflicts Deleting Timer Objects from Memory  Testing the Validity of a Timer Object  Deleting All Existing Timer Objects Finding All Timer Objects in Memory  Finding Invisible Timer Objects

Improving Performance and Memory Usage Analyzing Your Program’s Performance

 The M-File Profiler Utility  Stopwatch Timer Functions Techniques for Improving Performance  Vectorizing Loops  Preallocating Arrays  Coding Loops in a MEX-File  Assigning to Variables  Operating on Real Data  Using Appropriate Logical Operators  Overloading Built-In Functions  Functions Are Generally Faster Than Scripts  Load and Save Are Faster Than File I/O Functions  Avoid Large Background Processes Making Efficient Use of Memory  Memory Management Functions  Preallocating Arrays to Reduce Fragmentation  Enlarging Arrays with repmat  Working with Variables  Converting Full Matrices into Sparse  Structure of Arrays vs. Array of Structures MATLAB & SIMULINK Page12  Working with Large Amounts of Data Resolving “Out of Memory” Errors  General Suggestions For Reclaiming Memory  Compressing Data in Memory  Increasing System Swap Space  Freeing Up System Resources on Windows Systems

Programming Tips Command and Function Syntax

Mathematical Functions and Applications

 Trigonometry  Complex Numbers  Signal Representation, Processing, and Plotting  Poly nomials  Partial Fraction Expansion  Functions of Two Variables  User-Defined Functions  Plotting Functions  DataAnalysis  Maximum andMinimum  Sums and Products MATLAB & SIMULINK Page16  Statistical Analy sis  Random Number Generation Solutions to Systems of Linear Equations Curve Fitting and Interpolation  MinimumMean-Square Error Curve Fitting  Interpolation Integration and Differentiation  Numerical Integration .  Numerical Differentiation Strings, Time, Base Conversion and Bit Operations  Character Strings  Time Computations  Base Conversions and Bit Operations Symbolic Processing  Symbolic Expressions and Algebra  Manipulating Trigonometric Expressions  Evaluating and Plotting Symbolic Expressions  Solving Algebraic and Transcendental Equations UNIT

ELEMENTS OF GUI DESIGN WHAT IS A MATLAB GRAPHICAL USER INTERFACE? THE THREE PHASES OF INTERFACE DESIGN