This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Numerical Methods with MATLAB Spring 2008 Professor Warner 4 Least Squares 4.1 The Best Constant In this section we investigate how to fit simple mathematical models to experimental data. Let’s start by considering the data displayed in the following chart. Figure 1: Average Daily Temperature in Atlanta The chart shows the average daily temperature in Atlanta for the month of January, 2005. In describing this data we might say something like, “In the beginning of the month the temperature was in the fifties, but the temperature got colder towards the end of the month.” In fact, after the first week of January, the average daily temperature really bounces around, and it’s difficult to say anything that precisely relates the day of the month to the average temperature for that day. The first thing that we can try to do is to find a single number that “best” approximates the average daily temperature for the month. The real question is what do we mean by “best”. Let’s start by labeling the kth data point as x k . In other words, using the data in Table 1, we have x 1 = 55, x 2 = 57, . . . , x 31 = 44. Now let a stand for the unknown number that is the “best” approximation to this data. In scientific endeavors, the most common way to define “best” is that it is the value which minimizes the sum of the squared errors (SSE) . In other words we want to minimize SSE = (55 a ) 2 + (57 a ) 2 + · · · + (44 a ) 2 = ( x 1 a ) 2 + ( x 2 a ) 2 + · · · + ( x 31 a ) 2 1 Table 1: Average Daily Temperature in Atlanta Jan 2005 55 57 57 59 58 57 59 59 50 54 59 63 61 49 44 42 29 32 36 46 52 44 26 36 48 58 49 38 32 39 44 = 31 k =1 ( x k a ) 2 The next figure shows a plot of SSE for the data in Table 1 with a ranging from 20 to 70. Notice that this plot has a very welldefined minimum near a = 48. Notice that our formula for the SSE is a little different from the formulas you are probably used to. In our formula the items labeled x k are data that we know and the item labeled a is a variable that we don’t know. This means that SSE is a function of only one variable – the variable a . Consequently, we can find the minimum by calculating the derivative of SSE with respect to a , and determining the value of a that makes this derivative equal to 0. Although this calculation may be more involved than what you have typically seen, it is entirely elementary. First, we use that rule that the derivative of a sum is the sum of the derivatives....
View
Full Document
 Spring '08
 Warner
 matlab, Derivative, Vector Space, Least Squares, xk

Click to edit the document details