User Tools

Site Tools


gibson:teaching:spring-2015:math445:finaltopics

Math 445: final exam topics

Matlab basics

You should know the basic Matlab functionality for

  • Arithmetic operations
    • Writing mathematical expressions in Matlab with arithmetic operators - + * / ^
    • Assignment into variables with =.
    • How to enter numbers in scientific notation; e.g. 3.2e-04 means $3.2 \times 10^{-4}$.
    • How to enter complex numbers, e.g. 4 + 5*i.
  • Logical expressions (which evaluate to true or false)
    • how Matlab represents true with 1 and false with 0
    • comparison operators < > ⇐ >= == ~=, e.g. 3 < 2 has value false, or 0
    • logical operators && || xor ~ (and, or, exclusive or, not)
    • how to combine all these to make logical expressions, e.g. 3 < 2 || 4 > 1 has value true, or 1
  • Vectors and matrices
    • square bracket notation for creating row vectors, column vectors, matrices
    • when to use commas (separating elements in a row), when to use semicolons (marking end of row)
    • creating vectors with linspace and colon syntax, e.g. x = 0:0.01:4
    • creating vectors and matrices with zeros, rand, randn
    • matrix-vector multiplication, the definition and meaning
    • Ax=b problems, forming them from story problems or equations and solving in Matlab with \
    • accessing/setting elements, e.g. A(:,3) is the 3rd column of A
    • linear algebra operations: + - * \ ^ '
    • elementwise operations: - + .* ./ .^
    • matrix-vector input/output: load/save
  • Plotting functions of one variable
    • making plots of 1d functions $f(x)$ with plot, semilogy, semilogx, loglog
    • making plots with multiple graphs, colored, dashed, dot-dashed etc. lines, symbol markers
    • annotation: xlabel, ylabel, title, grid on, legend, axis, clf, legend, hold on, hold off
    • graphical data analysis: be able to determine y as a function of x from a plot
      • plot for y = mx + b
      • semilogy for y = c 10^(mx)
      • semilogx for y = m log x + b
      • loglog for y = c x^m
  • Plotting functions of two variables
    • creating X,Y matrices with meshgrid
    • plotting functions of two variables with pcolor, contour, contourf, surf, surfc, quiver
    • changing colors with colormap
    • displaying color scale with colorbar

Matlab programming: functions, scripts, loops

You should be able to write short Matlab programs to perform specified computations.

  • how to write a function in a file with .m extension
  • how to write an anonymous function, e.g. f(x) = @(x) x^2 - 3*x + 2
  • how to write a for loop to evaluate a sum or product
  • how to write a for loop to perform a repeated computation

Lab material

You should have a good grasp of the underlying mathematics and implementation in Matlab code of these labs, i.e. how to …

  • lab3 solve a set of linear equations Ax=b with Matlab's backslash operator
  • lab7 solve a nonlinear equation $f(x) = 0$ by coding f as an anonymous function and calling Matlab's fsolve function.
  • lab8 determine a transition matrix from a network of links and compute the Google Page Rank.
  • lab9 simulate uncertain systems like coin flips and Presidential elections with Monte Carlo simulation.
  • lab11, lab11, hw3 do numerical integration of differential equations with ode45
gibson/teaching/spring-2015/math445/finaltopics.txt · Last modified: 2015/05/05 07:28 by gibson