L=[1 2; 2 4; 3 7]Define the known RHS data vector by typing
t= [3 ; 6 ; 9]There are non-unique solutions to Ls=t if any column vector in L is a linear combination of the other column vectors, otherwise column vectors are linearly independent. Are the columns in L linearly independent? A numerical check for a poorly conditioned system of equations is to determine condition number (max eigenvalue/min eigenvalue) by typing
cond(L'*L)Large values of condition number indicate that columns are nearly linearly independent.
s = inv(L'*L)*L'*t
L=[1 2; 2 4; 3 7] ;t= [3 ; 6 ; 9]; xstart=-30;xend=30;hold off; for i=xstart:xend; ii=i-xstart+1; for j=xstart:xend jj=j-xstart+1;xx=[i j];eps(ii,jj)=(L*xx'-t)'*(L*xx'-t); end;end imagesc([xstart:xend],[xstart:xend],eps');colorbar;hold on; x=[xstart:xend]; for m=1:3;plot(x,(-L(m,1)*x+t(m))/L(m,2),'-w');end; title('Sum of Squared Error Misfit Function') xlabel('x');ylabel('y')
Are the equations consistent or inconsistent? Why? Are the lines nearly parallel? Why should nearly parallel lines lead to an ill-posed system of equations?