Linear Algebra - Least Squares

sheepover
Messages
4
Reaction score
0

Homework Statement

Test these two equations, using least-squares fitting of the data (ti, bi), i = 1, 2, . . . , 100:1.
b(t) = d_{1} + d_{2}te^{-t} + d_{3}t^{2}e^{-2t}2.
b(t) = d_{1} + d_{2}\sqrt{t}e^{-\sqrt{t}} + d_{3}te^{-2\sqrt{t}}

where d1, d2, d3 in R are unknown.

For both theories, compute the resulting values of the constants d1, d2, d3 and produce a graph that shows the original data and the computed function b(t).

Which one of the two theories is more appropriate for the given data?We are given t and b as 1x100 matrices in matlab, and I also have a Modified Gram-Schmidt program in MATLAB that computes Q and R for any matrix A, which is supposed to be used to solve this problem.

Homework Equations



A = QR
ATAx = ATb
min||b-Ax||

The Attempt at a Solution



Not even sure where to start. I've been searching online for any guidance for hours. Textbook is no help either.

If someone could at least point me in the right direction, or give me some steps to solve this, it would be appreciated.
 
Physics news on Phys.org
For 1, A is the matrix having each row of the form
\begin{array}{ccc}1 & t_ie^{-t_i} & t_i^2e^{-t_i}\end{array}
for each i. It will have 3 columns and 100 rows.

Similarly, for 2 A is the matrix having each row of the form
\begin{array}{ccc} 1 & \sqrt(t)e^{-\sqrt(t)} & te^{-2\sqrt{t}}\end{array}

Again it has 3 columns and 100 rows.
 
I am not sure where your confusion lies. Do you understand that what you need to do is to solve the 3 x 3 linear system B p = r, where B = A^T * A, r = A^T * b and p = column vector (d1,d2,d3)? If you don't get this, you really do need to go back and review the basics.

OK, so if you understand that you need to solve a 3 x 3 linear system, there is the issue of how to do that. You could simply write down the equations in Matlab and ask it to solve them---no matter how it chooses to do it. On the other hand, maybe the question is more about how to use QR factorization in solving the resulting 3 x 3 system---I don't know: I can't tell, from what you have written. (I do know that I, personally, would *never* ask anybody to use a factorization of a 100 by 3 matrix to solve a 3 by 3 system; I might ask for a QR factorization of the 3 by 3 matrix, but that is a different story.)

RGV
 
The point of the exercise given to sheepover is to use QR factorization on the data set and the trial functions in the problem to find the least-squares coefficients without forming the normal equations traditionally used for such calculations. In this case, it means the QR method is used directly on an over-determined system with 100x3 terms as one component.

Sheepover's Google must be broken because searching with "least squares QR" found results immediately.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top