## Matlab Tutorial

You can download the code used in this tutorial Members Only section of the website.

This tutorial provides a brief introduction to Matlab for people that don't have any current experience with the software. When you're done learning some of these basics, check out Matlab Cody. The Matlab Cody website has numerous coding problems for you to work and submit. After submitting your code it is "scored" against other submissions for correctness, code efficiency, etc. The website keeps track of how many challenge problems you've solved and ranks you with respect to other coders. It's a great way to practice and learn other basic Matlab concepts.

The Matlab Interface

11/17/13

Running Time: 5:16

This first video explores the Matlab command window, workspace, command history, editor, and other simple commands for working within the Matlab development environment.

Simple Matlab Calculations

11/19/13

Running Time: 5:01

This video explores some basic calculations in Matlab such as the the trigonometric functions, exponential function, logarithmic functions, etc.

Matlab Vector Operations

11/19/13

Running Time: 7:17

Matlab vector examples are defined and various vector operations (component-wise operations, scalar product, etc.) are examined and performed in Matlab.

Matlab Matrix Examples

11/21/13

Running Time: 7:38

How to define matrices and some simple matrix functions/operations: identity matrix eye() function, diagonal elements of a matrix with diag(), random matrices with rand(), all zeros matrix with zeros(), all ones matrix with ones(), transpose and complex-conjugate transpose operations, etc.

Matlab Indexing Examples

12/2/13

Running Time: 7:52

How to access and set elements of a vector or matrix using indexing and logical indexing in Matlab.

Matlab FOR Loop Examples

12/16/13

Running Time: 5:42

Simple examples of using FOR loops in Matlab.  The first two examples show the important of pre-allocating variables before use in a FOR loop.  While the absolute time difference in the example is not large for this specific case, for more complicated scenarios this time difference can be quite large.  The final example isn't really a FOR loop, but demonstrates the importance of using Matlab vector commands/operations where possible, as they are usually much faster.

Matlab IF Statement Examples

12/18/13

Running Time: 5:27

Simple examples of using IF statements in Matlab.  The exact use in this example isn't that interesting, but the main point here is to demonstrate the general syntax if IF/ELSE and IF/ELSEIF type statements.

Matlab Function Examples

4/5/14

Running Time: 4:47

This provides a simple example of writing and using a function in Matlab.  A function is just another m-file which is called with a specific input/output interface.  The specific function written fort his example is very simple (e.g. the function computes the area of a circle given the radius "r" of the circle), but it demonstrates the key components of function syntax.

Matlab Simple Plotting Examples

4/5/14

Running Time: 6:15

This video provides a simple example of using the Matlab "plot" function to plot signals versus time.  The example shows how to change line color, line type, change axis limits, label the axis, and place a figure title.

Matlab Multiple Plot Examples

4/5/14

Running Time: 4:24

This video provides a simple example of using the Matlab "plot" function to plot multiple signals in a single Matlab figure.  The key to this is using the Matlab "hold on" command.  This example also demonstrates the Matlab "legend" command to visually label the graph with a plot legend.

Matlab Subplots Examples

4/5/14

Running Time: 4:14

This video provides a simple example of using the Matlab "subplot" function to plot multiple signals in different axis within the same Matlab figure.

Matlab 3D Plots

4/5/14

Running Time: 4:41

Different methods for creating 3D plots are demonstrated in this video, including the Matlab "mesh", "contour", and "imagesc" functions, for visualizing a simple surface as a function of variables X and Y.

Useful Matlab Functions and Examples

4/5/14

Running Time: 5:12

Matlab has a multitude of built in functions for plotting, manipulating, and computing different quantities.  This video demonstrates the use of the Matlab "sort", "rand", "hist", "sum", "min", and "max" functions.  It also briefly describes how to search for other functions using the Matlab help interface.

Matlab Profiler and Saving Results

4/5/14

Running Time: 5:23

Matlab workspace variables can be saved to disk in a Matlab "mat" file using the Matlab "save" command.  This data can then be loaded later using the Matlab "load" command.  This save/load capability is useful when working with complex code that may take a long time to run.  In this case, it may make sense to save you results to keep from having to re-run the code again.

Matlab Tutorial Summary

4/5/14

Running Time: 7:52

This video presents a handful of tips, tricks, and best practices to conclude the tutorial.