%% N = 51; circle_points = [cos(linspace(0,2*pi,N)); sin(linspace(0,2*pi,N))]; figure; %% A matrix that stretches along x and squashes along y A = diag([1/2 2]) b = [0.3;0.6] %% A little messier example %A = [0.5645 0.1360; -1.3494 1.4464] %% A unit circle in x subplot(1,2,1); plot(circle_points(1,:), circle_points(2,:)); axis equal axis([-2.1 2.1 -2.1 2.1]); title('x space'); hold on; %% The transformation of the unit circle under A subplot(1,2,2); bs = A * circle_points; plot(bs(1,:), bs(2,:)); axis equal axis([-2.1 2.1 -2.1 2.1]); title('b space'); hold on; %% A choice of X that corresponds to large norm(b) x = [0;1]; subplot(1,2,1); plot(x(1), x(2), 'r+'); %% A choice of X that corresponds to small norm(b) x = [1;0]; subplot(1,2,1); plot(x(1), x(2), 'r+'); %% The image b b = A*x; subplot(1,2,2); plot(b(1), b(2), 'r+'); %% A set of small perturbations around x xs = x * ones(1,N) + 0.1*circle_points; subplot(1,2,1); plot(xs(1,:), xs(2,:), 'r'); %% The effects of those perturbations on b bs = A*xs; subplot(1,2,2); plot(bs(1,:), bs(2,:), 'r'); %% A choice of b that corresponds to large norm(x) b = [1;0]; subplot(1,2,2); plot(b(1), b(2), 'r+'); %% A choice of b that corresponds to small norm(x) b = [0;1]; subplot(1,2,2); plot(b(1), b(2), 'r+'); %% The solution x x = A\b; subplot(1,2,1); plot(x(1), x(2), 'r+'); %% A set of small perturbations around b bs = b * ones(1,N) + 0.1*circle_points; subplot(1,2,2); plot(b(1), b(2), 'r+'); plot(bs(1,:), bs(2,:), 'r'); %% The effects of those perturbations on x xs = A\bs; subplot(1,2,1); plot(xs(1,:), xs(2,:), 'r');