Forward, Backward, and Centered
Finite Difference Approximation
Let us find the approximate slope of a
continuous function at x=xi using the Taylor
series.
Actual slope at x = xi
f(x)
x i-1
xi
x i 1
First, we use forward expanded Taylor series
(h) 2 f' '

If you want to convert a syms expression
to a numerical value you can use a
double build in function.
Lab program
Without using double function
Final exam practice question
Should able to complete each within 20 min
Let us start the iterative process
by a

Lecture 22
Using Matlab to find minimum, maximum,
Integrals, and derivatives
Numerical Methods for Engineers, Chapre and Canale, McGraw Hill
Derivatives
If you skipped the syms
comment, Matlab will not able
to find the derivative.
You can plug in the x an

Lecture 21
Chapter 19
Simpsons 3/8 Rule
Chapter 7
Optimization
Using Matlab to find derivatives
Numerical Methods for Engineers, Chapre and Canale, McGraw Hill
Simpsons 3/8 Rule
The difference between the 1/3 and 3/8 rules is the number of data
point and

Lecture 19
Chapter 17
Interpolation
Newtons divided-difference interpolating polynomials
Lagrange interpolating polynomials
For n+1 data points, there is one and
only one polynomial of order n that
passes through all of the data points.
For example:
2 dat

Lecture 20
Chapter 19
Newton-Cotes integration formulas Trapezoidal Rule,
Simpsons 1/3 Rule, and Simpsons 3/8 Rule
Numerical Methods for Engineers, Chapre and Canale, McGraw Hill
How to find the area under a function between two
boundaries? By drawing a s

Polynomial Regression
Chapter 15
Measured data fitted with an unique
polynomial model.
Same least-square procedure apply to
a higher order of polynomial functions
For example, a second order polynomial
n
sr a0 , a1 , a2 yi a0 a1 xi a2 xi
22
i 1
y-values f

Iterative methods for solving matrix equations
Assume we have a series of equations
a11 x1 a12 x 2 a13 x 3 . a1n x n b1
(1a)
a 21 x1 a 22 x 2 a 23 x 3 . a 2n x n b2
(1b)
a n1 x1 a n2 x 2 a n3 x 3 . a nn x n b n
(1c)
where as and bs are known values.
Xn ar

Final exam cheat sheet
1 single page of equations.
No notes, not text, not figures, equations only.
Practice the example questions in textbook!
Summary
1) Write the model equation and the relationship
with yi and ei
e.g. y = a0 + a1 (x) + a2 (x)2 + e
2) S

Least-Square Regression
Chapter 14
Curve fitting
Produce an unique best fit solution
Before we start, let us review some of
the statistic definitions.
Average
n
y
y
i 1
i
n
n is the number of data point. yi is the value
of each data point.
Data spread aro

3 Bonus points on the final exam
(pick one of the 2 problems)
Write a matlab program that can
perform a Tic-tac-toe game that can
execute with 2 human players or a single
player. The computer must have the
capability to display the board and able
to check

Chapter 3
Errors
Round off error
Truncation error
Accuracy vs Precision
Accuracy describes how close the
measurements or computations to the true
value.
Precision describes how close individual data
points from each other. Note you can be very
precise but

We have used the bisection technique to find
the root which is a bracketing method. A more
efficient bracketing method is call the falseposition method.
The false-position method
Instead of picking a Xr vale half-way between
the upper and lower limits of

Taylor Series
More generally, a function can be approximated
using the Taylor series:
(h) 2 f' ' (x i ) (h)3 f' ' ' (x i )
f(x i 1 ) f(x i ) (h) f' (x i )
.
2!
3!
(h) n f (n) (x i )
.
Rn
n!
where Rn is called the remainder and f(n)(xi) is the
nth der

0111100
= 0.0625
0111101
= 0.078125
The increment is 0.015625
0110100
= 0.125
0110101
= 0.156250
The increment is 0.03125
Note the increment values (Dx)
increases with the nominal value.
0
Dx
x
where
and
Dx
x
( machine epsilon )
b
1t
b = base unit (e.g.

Lecture 23
Using Matlab to find minimum and maximum
Numerical Methods for Engineers, Chapre and Canale, McGraw Hill
Finding minimum and maximum of a given function
Find minimum of single-variable function on fixed interval
fminbnd(function name, lower lim