Download presentation
Presentation is loading. Please wait.
Published byApril Wilkerson Modified over 6 years ago
1
working 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
2
What kind of graph? Engr 0012 (04-1) LecNotes 12-02
3
What kind of graph? Engr 0012 (04-1) LecNotes 12-03
4
What kind of graph? Engr 0012 (04-1) LecNotes 12-04
5
What kind of graph? Engr 0012 (04-1) LecNotes 12-05
6
What kind of graph? Engr 0012 (04-1) LecNotes 12-06
7
What kind of graph? Engr 0012 (04-1) LecNotes 12-07
8
What kind of graph? Engr 0012 (04-1) LecNotes 12-08
9
How good is the fit? Engr 0012 (04-1) LecNotes 12-09
10
How good is the fit? Calculate error Know: Want to calculate error:
xdata ydata equation: y = f(x) Want to calculate error: error = abs(ydata - xdata) error = abs(ydata - f_at_xdata) Examples: f_at_xdata = m*xdata + b Linear: Power law: f_at_xdata = A*xdata.^B Engr 0012 (04-1) LecNotes 12-10
11
How 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
12
Programming 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 Budny for help Quiz on Wednesday Find best fit to a data set: equation and error Engr 0012 (04-1) LecNotes 12-12
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.