Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random |  
Login
create new user
Username:
Password:
forget your password?
Main Menu
Sections

Meta

Talkback

Downloads

Information
example of linear least squares (Topic)

The assumption of linear least squares is that there is a linear relationship between our measurements z and the variables to be estimated x

z = M x + b
(1)

For this example let us assume that our measurements are given in Table 1 and you can see them plotted in Figure 1.












x-3.0 -2.5 -2.0-1.5-1.0-0.50.00.51.01.5
z-1.0-0.25 0.0 0.25 0.4 0.7 1.01.11.41.8











           

Table 1: Example Data

The linear least squares solution to fit the given data is given by the equation

xfit = (AT A )−1AT z
(2)

The only not so obvious step before using a tool like Matlab, is to form the A matrix, which is a combination of an identity vector and x as column vectors, such that

A = [ 1 | x ]

This is clarified by looking at the example code in Matlab, LinearLeastSquares.m. A plot of fitting the measurement data with a line such that it minimizes the the mean square of the error is shown in Figure 1.

The equation of the line to fit this data is then

z =  0.543x +  0.947

PIC

Figure 1: Linear Fit of Example Data (Matlab)

PIC

Figure 1: Linear Fit of Example Data (rlplot)


"example of linear least squares" is owned by bloftin.
(view preamble)
View style:

Cross-references: vector, identity, matrix, squares

This is version 6 of example of linear least squares, born on 2007-03-24, modified 2007-03-25.
Object id is 245, canonical name is ExampleOfLinearLeastSquares.
Accessed 3550 times total.

Classification:
Physics Classification06.20.Dk (Measurement and error theory)
Pending Errata and Addenda
None.
Discussion
Style: Expand: Order:

No messages.

Interact
rate | post | correct | update request | add example | add (any)