Numerical Methods

Example of MATLAB 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 of if-else statements
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

MATLAB codes for class

CHAPTER1
bisect.m (Bisection method from Sauer's book)
bisection.m (Bisection method revised)
exa_mybisect.m (Animation for bisection method)
fpi.m (Fixed Point Iterations from Sauer's book)
fpiseq.m (Fixed Point Iteration. Outputs the iteration sequence.)
exa_myfpi.m (Animation for fixed point iteration)
fixpt.m ( Another Fixed Point Iteration function with additional output)
newton.m (Newton's Method)
secant.m (Secant Method, with stopping criteria |x_old -x_new| < tol)
secant2.m (Secant Method with Max # of iterations as input argument)

CHAPTER2
GE.m Simplistic implementation of Gaussian Elimination (script)
backsub.m Book Implementation of back solve alhorithm
UTriSolAug.m Function, to solve an Upper triangular system by Backward Substitution.
trisys.m ( Gussian Elimination method for a tridiagonal system)

CHAPTER3
newtdd.m (Newton's Divided Differences Interpolant - from Sauer's book)
runge.m Function that shows the Runge phenomena for f(x) =1/(1 +12 x^2) on [-1 1].

CHAPTER4
DrugModel.m drug model for example 4.11, page 214 Sauer's book.

CHAPTER5
trapezoid.m Uses the composite trapezoidal rule to approximate Integrals
CTRuleOrder.m Script file to check that the Error for the Composite Trapezoid Rule is: Error(h) = O(h^2). The function: f (x)=sin(x) on [0 pi].

CHAPTER6
euler.m Euler's method for solving IVPs
exa_euler.m Example:y'= t*y +t^3; The exact soln:y=3*e^(t^2/2)-t^2-2;
heunT.m Heun's ( or trapezoid) method for solving IVPs
rk4.m Runge-Kutta of order 4 method for solving IVPs
rk4s.m Runge-Kutta of order 4 method for Systems
VF.m Matlab Vector Function - RHS for a system of DE to be solved by rk4s.m
RK4Sys_ex.m solves harmonic oscillator with RK4 method
ode_ex.m solves harmonic oscillator: harm_osc.m

CHAPTER7
VF4ivp.m Matlab Vector Function - RHS for an IVP system used with the shooting method
F4bis.m Matlab scalar function (to be used by bisection method) for solving a bvp using the shooting method

Sierpinski fun
sg.m
gasket.m

Lorenz System
lorenz.m
lrun.m

Department of Mathematical Sciences