% % This script demonstrates the increasing relative % projections in the Least Sqares problem for a % sequence of RHS b_j of increasing norm that % all have the same projections onto Range(A) % % To get a good aspect ratio on the plot % stretch the window by hand along the z - axis % after the first plot appears % % D.C. Sorensen % 4 Oct 01 %---------------------------------------------------- % for tau1 = [10 50 100 150], m = 200; t = linspace(0,(6.5*pi/4),m); x = cos(t); y = sin(t); z = t/10; x1 = [0 x(m)]; x2 = [0 y(m)]; x3 = [0 z(m)]; z1 = [x(m) x(m)]; z2 = [y(m) y(m)]; z3 = 0*x3; plot3(x1,x2,z3,'b') hold % % Plot four vectors of increasing length % that all have the same projection % onto the Range(A) % for tau = [10 50 100 150], plot3(x1,x2,tau*x3,'k') plot3(x1(2),x2(2),tau*z(m),'k+') end plot3(z1,z2,tau*x3,'m') t = linspace(0,2*pi,m); x0 = cos(t); y0 = sin(t); w = 0*t; mu = 2; x = x0*mu; y = y0*mu; plot3(x,y,w,'c'); x = x0*mu; tau = tau1 % % Construct a perturbation to the RHS b % % of size mu*norm(b) % % where mu = .005 % b = [x1(2) x2(2) tau*z(m)]; bnorm = norm(b); mu = .005*bnorm; % % Plot the projection of the circle of such perturbations % in the Range(A) - in this case the x,y plane % x = x1(2) + x0*mu; y = x2(2) + y0*mu; plot3(x,y,w,'r'); % % Plot the circle of such perturbations about b % parallel to the x,y plane % w = tau*z(m)*ones(m,1); plot3(x,y,w,'k'); grid hold if (tau1 < 20), disp(' To get a good aspect ratio on the plot ') disp(' stretch the window by mouse along the z - axis ') disp(' after the first plot appears ') end disp(' ') disp('strike any key to continue') pause end