%% Small singular values
% Test 1
d=[1e-8,1:1:48];
D=diag(d);
A=[D;zeros(1,49)];
rank(A)

[UA,SA,VA]=svd(A);
semilogy(SA,'o'),hold

%% Test 2
B0=rand(50,48);
b=sum(B0,2);%+1e-12*rand(50,1);
B=[B0 b];rank(B)

[UB,SB,VB]=svd(B);
semilogy(SB,'r*')

%% Test 3
b=sum(B0,2)+1e-8*rand(50,1);
B=[B0 b];rank(B)

[UB,SB,VB]=svd(B);
semilogy(SB,'gp')
