Home > General-Functions > SUGR > Point_Pair_2D > sugr_perturb_2D_point_pairs_spherical.m

sugr_perturb_2D_point_pairs_spherical

PURPOSE ^

% Perturb sampled 2D points pairs sphericaly

SYNOPSIS ^

function PP = sugr_perturb_2D_point_pairs_spherical(PP_true,sigma_x,sigma_y,rho,fp)

DESCRIPTION ^

% Perturb sampled 2D points pairs sphericaly

 PP = sugr_perturb_2D_point_pairs_spherical(PP_true,sigma_x,sigma_y,rho,fp);
 
 PP_true = struct, sugr point pairs 2D, true point pairs
              .h(N,6)  homogeneous coordinates of N point pairs stored in each row [x1_n', x2_n']
              .Crr(N,4,4) according reduced CovM
 sigma_x   = standard deviation for perturbation of x's: CovM = sigma_x^2 I_2
 sigma_y   = standard deviation for perturbation of y's: CovM = sigma_x^2 I_2
 rho       = correlation coefficient
 fp        = magnification factor for plot

 PP perturbed point pairs

 Wolfgang Förstner 10/2011
 wfoerstn@uni-bonn.de

 See also sugr_perturb_2D_point_pairs, sugr_perturb_3D_2D_point_pairs,
 sugr_perturb_Lines_2D

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Perturb sampled 2D points pairs sphericaly
0002 %
0003 % PP = sugr_perturb_2D_point_pairs_spherical(PP_true,sigma_x,sigma_y,rho,fp);
0004 %
0005 % PP_true = struct, sugr point pairs 2D, true point pairs
0006 %              .h(N,6)  homogeneous coordinates of N point pairs stored in each row [x1_n', x2_n']
0007 %              .Crr(N,4,4) according reduced CovM
0008 % sigma_x   = standard deviation for perturbation of x's: CovM = sigma_x^2 I_2
0009 % sigma_y   = standard deviation for perturbation of y's: CovM = sigma_x^2 I_2
0010 % rho       = correlation coefficient
0011 % fp        = magnification factor for plot
0012 %
0013 % PP perturbed point pairs
0014 %
0015 % Wolfgang Förstner 10/2011
0016 % wfoerstn@uni-bonn.de
0017 %
0018 % See also sugr_perturb_2D_point_pairs, sugr_perturb_3D_2D_point_pairs,
0019 % sugr_perturb_Lines_2D
0020 
0021 function PP = sugr_perturb_2D_point_pairs_spherical(PP_true,sigma_x,sigma_y,rho,fp)
0022 
0023 global plot_option 
0024 
0025 Pth   = PP_true.h;
0026 % PtCrr = PP_true.Crr;
0027 
0028 N = size(Pth,1);
0029 
0030 Cppr     = [sigma_x^2*eye(2) sigma_x*sigma_y*rho*eye(2);...
0031             sigma_x*sigma_y*rho*eye(2) sigma_y^2*eye(2)];
0032 for n=1:N
0033     % perturbed point pair
0034     dp       = sugr_rand_gauss(zeros(4,1),Cppr, 1);
0035     ps(1:3)  = sugr_ghm_update_vector(Pth(n,1:3)',dp(1:2));
0036     ps(4:6)  = sugr_ghm_update_vector(Pth(n,4:6)',dp(3:4));
0037     PP.h(n,:)     = ps;
0038     PP.Crr(n,:,:) = Cppr;
0039     PP.type(n)    = 8;
0040 end
0041 
0042 if plot_option > 0
0043     figure
0044     for n=1:N
0045          xh = PP.h(n,1:3)';
0046          yh = PP.h(n,4:6)';
0047          Cxx = null(xh') * squeeze(PP.Crr(n,1:2,1:2)) * null(xh')';
0048          Cyy = null(yh') * squeeze(PP.Crr(n,3:4,3:4)) * null(yh')';
0049          x = sugr_Point_2D(xh,Cxx);
0050          y = sugr_Point_2D(yh,Cyy);
0051          sugr_plot_Point_2D(x,'.k','-r',2,fp);
0052          sugr_plot_Point_2D(y,'.k','-b',2,fp);
0053          l=sugr_construct_join_Line_2D(x,y);
0054          sugr_plot_Line_2D(l,'-k','-w',1,5,[0,0]);
0055     end
0056     axis equal
0057 end
0058

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005