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 system1. Least squares methods, Ch 42.45. 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 R2 such 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.
Hint: B=[ones(size(T)) -1./T]. The result should be somewhere around k0=1e8, E=8e4. 3. Dynamical systems and linearization |
Editor: Rickard Bergström Last modified: Mon Feb 24 17:09:57 MET 2003 |