80 likes | 164 Views
Introduction. Today we are looking at how to interpret experimental data Normally, data is acquired with random errors How do we take the data and determine a model tha t explains the experiment?. Warm-Up Problem. How far is th e point from the line in the y-direction?.
E N D
Introduction • Today we are looking at how to interpret experimental data • Normally, data is acquired with random errors • How do we take the data and determine a model that explains the experiment?
Warm-Up Problem How far is the point from the line in the y-direction?
Curve Fitting (regression) • Engineers often have to fit imperfect data to models of how a system behaves • Material tests • Circuit output • Wind tunnel tests • There are always errors in experimental data • Imperfect models • Imperfect sensors • We need to find the “best fit” of the model to the data • Minimize the cumulative error in the measurements
Curve Fitting (regression) • MATLAB has tools to fit lines and curves to data • In Class example: • Download “Curve Fitting Data” from the course webpage • In MATLAB, load curve_fit • plot(x,y) • We need to fit a curve to this data • In the figure window, go to the “tools” menu and select “Basic Fitting” • Select “linear” • This line is chosen to fit the data in a way that minimizes the difference between the measurements and the curve • Check the “show equations” box • Check the “plot residuals” box • Check the “show norms of residuals” box • Now select higher order curves to fit to the data • Are these solutions better? Why?
Curve Fitting (regression) • We can also use the MATLAB command “polyfit” to do the same job in the command window • The result is the polynomial vector • Try polyfit(x,y,2) to give a quadratic curve fit
Concept Questions • What are 2 sources of errors in experimental data? • In what sense is a curve the “best fit” of the data? • If you want to fit a line to a set of 2 data points, what will the resulting error between the model and the data points be?
Group Problem • You are a part of a firm designing nanoscale speedometers to measure speeds of asmall moving creatures like centipedes. To test your sensor, you gather a centipede and you measure the follwing data, in MATLAB notation: • T = [0 20 40 60 80 100 120]; %time (sec) • S = [0 105 197 310 390 502 599]; %position (mm) • Use the data to create a graph and a mathematical model • Use polyfit to fit a line to the data • Use polyval to calculate points on the line over a range of T = 0 to 120 • Plot the line fit as a line and the data as indivdual points on the same plot • Add appropriate labels and a title to the plot • Add a legend to the plot
For Next Time • Read Chapter 11 in the Gilat book (prepare for a quiz on the reading)