0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 clc
0018 clear vars
0019
0020 addpath(genpath('../../General-Functions'))
0021
0022 sugr_INIT
0023
0024 disp('--------------------------------------------')
0025 disp(' bR from (U,V) = svd(E),x'',x'''' (Alg. 20) ')
0026 disp('--------------------------------------------')
0027
0028
0029
0030 Rs = eye(3);
0031 Rss = calc_Rot_r(randn(3,1));
0032
0033 bh = randn(3,1);
0034 bh = bh/norm(bh);
0035
0036 X = randn(3,1);
0037
0038 xs = Rs*X;
0039 xss = Rss*(X-bh);
0040
0041
0042 v = sign(randn(1));
0043 disp(strcat('random_sign of_E = ',num2str(v)));
0044 E = Rs*calc_S(bh)*Rss'*v
0045
0046
0047 [U,D,V] = svd(E);
0048 U = U*det(U);
0049 V = V*det(V);
0050
0051
0052
0053
0054
0055 disp('b and R from E using set of pairs of directions')
0056
0057 [bes,Res] = sugr_bR_from_E_uv(E,xs',xss')
0058
0059 Es_check = sugr_E_Matrix(bes,Res);
0060 disp('check results, differences of given and estimated b and R should be zero' )
0061 diff_bRs_should_be_zero = [bh-bes,Rss-Res,v*E-Es_check.E]
0062
0063
0064 disp('b and R from U and V using set of pairs of directions')
0065
0066 [be,Re] = sugr_select_bR_from_E_UV_uv(U,V,xs',xss')
0067
0068 E_check = sugr_E_Matrix(be,Re);
0069 disp('check results, differences of given and estimated b and R should be zero' )
0070 diff_bR_should_be_zero = [bh-be,Rss-Re,v*E-E_check.E]
0071
0072
0073