Script: array_examples.m
Contents: Arrays (no matrix-math ops)
- Construction: direct, block methods, grid methods, Matlab functions
- Operations (element-wise): arithmetic, comparison, functions, logical
- Indexing and Slicing (vectors/matrices): single element access, range/slicing, index/selector vector, masked access
- Size and Shape: length, size, numel, isscalar, isvector, ismatrix, isrow, iscolumn
- Rearranging and reshapeing: transpose, sort, flip, reshape
- Aggregate functions: statistical (min, max, mean, median, sum, prod, std, var, cumsum), and logial (all, any)
- Matlab
findfunction
Script: functions_script.m
Contents:
- Function calling
- Function definition
- Functions that works with scalar, vector and matrix inputs
- Functions with no outputs
- Functions with no inputs
- Functions that require reshaping the inputs
- Functions with outputs of the same shape as input
- Functions with conditional execution and return
- Function handles
- Definition of anonymous functions (without names)
- Functions with function handles as inputs
- Functions with function handles as outputs
Function file: math_function.m
Contents:
- Functions defined in their own .m function file
- Local functions in function files
Script: cond_loops.m
Contents:
if,if-else,if-elseif-elsestatements- Composite conditional expressions
- Conditions involving vectors and arrays
- Conditions involving array type: scalar, vector (row, column), matrix
forstatements- Matrix construction, row-by-row and column-by-column loops
- Looping over matrix row and columns
Script: loops_seq.m, Application: recurrences relations
Contents:
- Store all elements of the sequence and pre-allocation
- Store only last element
- Applications: computing square root of a number, Fibonacci numbers, exponential function
whilestatements- Looping until convergence
Script: plotting.m
Contents:
- Line plots
- Scatter plots
- Line and marker plots
- Multiple plots in the same axis
- Labels, Legend, Axis properties, Grid, Axis ticks
- Figures
- Sub-plotting
- Long form line/marker style properties
- Saving a figure to an image file
- Annotation: Lines, Shapes, Text, Arrows
Script: lse_matrix_math.m
Contents:
- Matrix Math: Matrix Product, Sum, Inverse, Power
- Solving Systems of Linear Equations. Matlab function:
inv, Left and Right Matrix Division - Examples
Script: regression.m
Contents:
- Linear Regression
- Polynomial Regression. Matlab Functions:
polyfit,polyval - Prediction Error. Mean Square Error. Mean Absolute Error. Correlation Coefficient (linear regression)
- General Regression
Script: interpolation.m
Contents:
- Zeroth-order Spline Interpolation
- Linear Interpolation. Matlab function:
interp1 - Natural Cubic Spline Interpolation. Matlab function:
spline - Interpolation of 2D Curves
Script: root_finding.m
Contents:
- Bisection Method
- Newton's Method
- Secant method
- Matlab function:
fzero
Script: diff_int.m
Contents:
- Numerical Differentiation. Forward, Backward, and Central Methods
- Differentiation of a known function
- Differentiation when data is given
- Numerical Integration. Trapezoid Method
- Integration of a known function
- Matlab function:
integral - Multiple dependent variables, one independent variable
- Integration when data is given
- Polynomials - Integration and Differentiation. Matlab functions:
polyder,polyint
Script: ode.m
Contents:
- Euler's Method
- Scalar case: one dependent variable
- Vector case: multiple dependent variables
- Matlab function:
ode45
- Scalar case: one dependent variable
- Vector case: multiple dependent variables
- Systems with Inputs. Closed-loop control using proportional controller