Math 353 Engineering Mathematics III

Spring 2006

Courtesy of Richard J. Braun


Matlab examples codes.

Warming up
Plot1.m
Plot2.m
Plot3.m
Plotseq3.m Sequence of plots with increasing resolution
RatFunPlot.m Basic plot of rational function approximation and exp(-x)
RatFunPlot2.m Fancier plot of rational function approximation and exp(-x)
Table1.m Table example from handout
TableProb.m Table problem in homework
Format_ex.m Examples of different formats
TestSign.m TestSign2.m Examples if-else-end constructs Darts.m Estimating Pi (From Van Loan)
Zoom.m Small scale look at function (from Van Loan)
Zoom2.m Small scale look at function, modified
Quadratic formula Quad1.m Quad2.m
Numdiff.m Numerical differentiation, centered formula
Functions
MyExpF.m MyExp1.m MyExp2.m Functions for Taylor polynomials approximating the exponential from Van Loan
TestMyExpRB.m TestMyExpRB1.m TestMyExpRB2.m Scripts for testing above functions (updated Van Loan)
trap1_05f.m Use this trapezoidal rule code as a starting point for Hw 6.
Functions
Bisection1.m Bisection method, no Matlab functions (yuck)
Bisection2.m Bisection method, with Matlab functions
Bisection3.m Bisection method as a Matlab function (black box for answer)
Sample function file f1.m
f2.m Simple function to zero, f(x)=x^3-x^2
f2p.m Derivative of f2.m
SimpleNewton.m Very simple implementation of Newton method
Ordofconv.m Two sequences with different order of convergence
RJB_Newton2.m Implementation of Newton method
RJB_Secant2.m Implementation of Secant method
Direct Solution of Linear Systems
GE06.mSimplistic implementation of Gaussian Elimination (script)
GEBS04_1.m Simplistic implementation of Gaussian Elimination and Backward Substitution (script)
GEBS04.m Function version of GEBS04_1.m
GEPPBS04_1.m Script, added partial pivoting GEPPBS04.m Function version
Benchmarking: TimeGEandBS.m Script for timings (calls GEBS04.m and UTriSolAug.m).
UTriSolAug.m Function, augmented matrix form of Backward Substitution.
Iterative Solution of Linear Systems
GaussJac.m Large system trends, Jacobi iteration
GaussSeid.m Large system trends, Seidel iteration
Splines and such
Home-grown splines: SplineClampUni.m Clamped ends; SplineNatUni.m Natural splines.
Matlab spline function: SplineMat.m (based on Van Loan)
Numerical Integration
Simple Composite Trapezoidal rule: easiest: Trapez.m vectorized: Trap2.m
Simple Composite Simpson's rule: easiest: Simp1.m vectorized: Simp2.m
Initial Value Problems
Euler1Eq.m solves single ode
RK4Sys_ex.m solves harmonic oscillator with RK4 method
ode_ex.m solves harmonic oscillator: harm_osc.m
Linear or Nonlinear Boundary Value Problems
bvp_ex.m Script for using bvp4c in matlab. Functions needed: bvp_exf.m bvp_exbc.m
PDE examples
heateq_explicit.m Explicit or Forward Difference method for heat equation.
heateq_bkwd.m Fully implicit or Backward Difference method for heat equation.
heateq_bkwd.m Crank-Nicolson method for heat equation.
PoissonEqEx.m Finite difference method for a Poisson equation.

Department of Mathematical Sciences

Richard Braun, last modified 11/11/05 UUTF-8ZCtrlWindow_/http://www.math.udel.edu/~braun/M353/Codes.html 13<Rds‰ ¦°»Ùðú2c2i2t2