Title: Lessons from CST exercise
1working toward a script that will help analyze
data
Big steps in accomplishing goal
1. Load data from file (have already created
function)
2. Display options
1. linear fit with equation and error
2. semi-log fit with equation and error
3. log-log fit with equation and error
4. linear display with polynomial-fit equation
and error
5. linear display with spline-fit
3. Quantitative output to screen (equation and
error)
Engr 0012 (04-1) LecNotes 12-01
2What kind of graph?
Engr 0012 (04-1) LecNotes 12-02
3What kind of graph?
Engr 0012 (04-1) LecNotes 12-03
4What kind of graph?
Engr 0012 (04-1) LecNotes 12-04
5What kind of graph?
Engr 0012 (04-1) LecNotes 12-05
6What kind of graph?
Engr 0012 (04-1) LecNotes 12-06
7What kind of graph?
Engr 0012 (04-1) LecNotes 12-07
8What kind of graph?
Engr 0012 (04-1) LecNotes 12-08
9How good is the fit?
Engr 0012 (04-1) LecNotes 12-09
10How good is the fit?
Calculate error
Know
xdata
ydata
equation y f(x)
Want to calculate error
error abs(ydata - yeqn _at_ xdata)
error abs(ydata - f_at_xdata)
Examples
Engr 0012 (04-1) LecNotes 12-10
11How good is the fit?
Calculate total error
Sum error vector
Two methods
use for loop (you have seen this)
use MATLAB function - which one?
Find maximum error (and x-location)
Search error vector for greatest value
Two methods
use for loop - note index for largest
use MATLAB function - which one?
Note x-location of maximum error
x_maxerr xdata(index for largest)
Engr 0012 (04-1) LecNotes 12-11
12Programming Assignment 05 Bonus - 50 pts
Display equation and r2 statistic on plot for
linear, exponential, power law, and polynomial
fits
Note unlike error, r2 is calculated in
transformed space for exponential and
power law fits.
see pp 6-8 Workshop 15 sec 4.13.3 Budny for
help
Engr 0012 (04-1) LecNotes 12-12