ALA C, 2003, vecka 1, Studio 1b

 

[Kurssidan, vecka 1, vecka 2, vecka 3, vecka 4, vecka 5, vecka 6, vecka 7, Matlab]

Linjär algebra i R^n: Minsta kvadrat-metoden, dynamiska system

1.  Least squares methods, Ch 42.45.
Define the matrix B and vector u as in the previuos exercise (Studio 1).We recall that the vector u does not belong to R(B), so that the equation Bx=u has no solution.   It is therefore impossible to make the residual Bx-u equal to 0, and we try instead to minimize the norm of the residual:

find x in R2 such that  || Bx-u ||2 is minimized.

The is called "the least squares method".   We know that the distance   || Bx-u ||  is minimal when Bx is the projection of u onto V=R(B)=span(a,b), which is exactly what we computed in exercise 1.  So we have just computed the least squares solution x.    Now we will do it again in a different way.

Pu is determined by the equation

(u-Pu,v)=0  for all v in V=R(B)

Here we have Pu=Bx and v=By for some x,y in R2.  Hence, we want to find x in Rsuch that

(u-Bx,By)=0  for all y in R2.

Here  (u-Bx,By)=(BTu-BTBx,y)  so that (BTu-BTBx,y)=0 for all y in R2.  This implies that

(*)   BTBx=BTu           (the normal equations)

Here we used the fact that (w,y)=0 for all y, implies w=0.  Prove this!   Hint:  we can take y=w because the equality should hold for all y.

Prove that BTB is symmetric.

Set up the normal equations with the given matrices B, u and solve the equations using Matlabs backslash (x = (BTB)\(BTu)). Compare with what you got in Studio 1a. What happens when you do only x=B\u? In matlab the backslash operator:  x=B\u  gives the least squares solution if the equation Bx=u has no solution.

2.  The tank reactor.
The Arrhenius rate law is  k=k0 exp(-E/(RT)).   The task is to determine the rate constant k0 and the activation energy E from the given information in Table 1.   Form the logarithm of this equation to get at linear relation between y=log(k) and x=1/T, y=b+ax.  Use the given information about the reaction rate to generate several data points   Ti, ki.   (where T is the absolute temperature [K].)  Then set up a linear system of equations and solve them by the least squares method.    The idea is that we determine the coefficients a, b by finding a straight line y=b+ax that fits the given data points as well as possible, i.e., find a,b so that the norm of the residual b+axi-yi is minimized.

Table 1
T [K] 343 353 363 373 383 393 403
k [s-1] 2.8e-5 5.6e-5 11.2e-5 22.4e-5 44.8e-5 89.6e-5 179.2e-5

Hint:   B=[ones(size(T)) -1./T].   The result should be somewhere around  k0=1e8, E=8e4.

3.  Dynamical systems and linearization
Do problems 91.4-5 d) from 91. Linearization and stability (ps). Use plots with the solution plotted against time as well as phase portraits (if you have forgotten about phase portraits, check studio 5.1 from ALA-B).


Editor: Rickard Bergström
Last modified: Mon Feb 24 17:09:57 MET 2003