Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
3-D plane fitting

Subject: 3-D plane fitting

From: diensa refranto

Date: 17 Jan, 2009 05:18:02

Message: 1 of 2

hellow . le me introduce myself .

i'm diensa , still student , and now i have a home work that to solve a 3-d plane fitting use least square adjustment ( this case is to fit a cube ). the main of this solution is to find the dx , dy , dz .


there are 2 main equation , to solve this problem ,

1 . plane equation :

vi = Ajxi + Bjyi + Cjzi + Dj ; pi = 0

j = is a face of a plane (1 to 6 )
i = is a point that construct the plane (1 to 8)
Aj,Bj,Cj,Dj = is a plane parameters
pi = weight distribution

after the parameter above is solve than go to the next step , the equation are :
2 . vi = Ajdxi + Bjdyi + Cjdzi + (Ajxi + Bjyi + Cjzi + Dj) ; pi =0

dx = change coordinate x
dy = change coordinate y
dz = chage coordinate z

than use adding observation equation of the geometric orthogonality, the equation are :

v j = (Δx j+1, j − Δx j, j−1)dx j + (Δy j+1, j − Δy j, j−1)dy j + Δy j+1, jΔy j, j−1 + Δx j+1, jΔx j, j−1 ; p j

this 2equation is solve by simultaneously



It would be really helpful at this point if anybody can
come up with the real matlab commands for this simpler case.
Then, I'd be able to learn from it,

Any web-link to examples would also greatly help (I am
trying to google, but yet to hit the right ones..).

this is the link for this equation description : http://www.photogrammetry.ethz.ch/research/3DGIS/isprs_ccm.ps.Z


 thx before

Subject: 3-D plane fitting

From: diensa refranto

Date: 17 Jan, 2009 08:40:05

Message: 2 of 2

"diensa refranto" <diensa.refranto@gmail.com> wrote in message <gkrpma$6j2$1@fred.mathworks.com>...
> hellow . le me introduce myself .
>
> i'm diensa , still student , and now i have a home work that to solve a 3-d plane fitting use least square adjustment ( this case is to fit a cube ). the main of this solution is to find the dx , dy , dz .
>
>
> there are 2 main equation , to solve this problem ,
>
> 1 . plane equation :
>
> vi = Ajxi + Bjyi + Cjzi + Dj ; pi = 0
>
> j = is a face of a plane (1 to 6 )
> i = is a point that construct the plane (1 to 8)
> Aj,Bj,Cj,Dj = is a plane parameters
> pi = weight distribution
>
> after the parameter above is solve than go to the next step , the equation are :
> 2 . vi = Ajdxi + Bjdyi + Cjdzi + (Ajxi + Bjyi + Cjzi + Dj) ; pi =0
>
> dx = change coordinate x
> dy = change coordinate y
> dz = chage coordinate z
>
> than use adding observation equation of the geometric orthogonality, the equation are :
>
> v j = (Δx j+1, j − Δx j, j−1)dx j + (Δy j+1, j − Δy j, j−1)dy j + Δy j+1, jΔy j, j−1 + Δx j+1, jΔx j, j−1 ; p j
>
> this 2equation is solve by simultaneously
>
>
>
> It would be really helpful at this point if anybody can
> come up with the real matlab commands for this simpler case.
> Then, I'd be able to learn from it,
>
> Any web-link to examples would also greatly help (I am
> trying to google, but yet to hit the right ones..).
>
> this is the link for this equation description : http://www.photogrammetry.ethz.ch/research/3DGIS/isprs_ccm.ps.Z
>
>
> thx before
>
>
>
>


oh yes this is my m-file

clc;
clear;
%---------------------------step 1--------------------------------------
%----------------------bidang referensi---------------------------
%koordinat fix .. plane dasar ( fix koordinat)
%acuan.txt = berisi koordinat dasar bidang yang benar / memenuhi syarat orthogonality
f=[];
f=load('acuan.txt');

%----------------------koordinat kubus----------------------------
%koordinat yang di cari dengan metode perataan
%iterasi 1 = berisi koordinat kubus yang akan dihitung ( mempunyai perbedaan sudut sebesar 1 derajat)
k=[];
k=load('iterasi1.txt');

%------------------------------------------------------------------
%adjustment per-satuan bidang untuk mencari parameter A B C D
% AX-F=0
% vi =sqrt((dxi)^2+(dyi)^2+(dzi)^2)
% parameter Aj Bj Cj Dj
%------------------------------------------------------------------

% bidang satu titik 1 2 3 4
%matrix desain A
A1=[];
A1(1,1:4) = [k(1,1) k(1,2) k(1,3) 1];
A1(2,1:4) = [k(2,1) k(2,2) k(2,3) 1];
A1(3,1:4) = [k(3,1) k(3,2) k(3,3) 1];
A1(4,1:4) = [k(4,1) k(4,2) k(4,3) 1];

%matrix F
f1=[];
f1(1,:) =[sqrt((k(1,1)-f(1,1))^2+(k(1,2)-f(1,2))^2+(k(1,3)-f(1,3))^2)];
f1(2,:) =[sqrt((k(2,1)-f(2,1))^2+(k(2,2)-f(2,2))^2+(k(2,3)-f(2,3))^2)];
f1(3,:) =[sqrt((k(3,1)-f(3,1))^2+(k(3,2)-f(3,2))^2+(k(3,3)-f(3,3))^2)];
f1(4,:) =[sqrt((k(4,1)-f(4,1))^2+(k(4,2)-f(4,2))^2+(k(4,3)-f(4,3))^2)];

%nilai bobot P=1;
%matrix X1 = A1,B1,C1,D1,
%X1 = parameter yang didapat dari hasil pengolahan tersebut
X1=(inv(A1'*A1))*(A1'*f1);

%-------------------------------------------------------------------

% bidang dua titik 2 3 6 7
%matrix desain A
A2=[];
A2(1,1:4) = [k(2,1) k(2,2) k(2,3) 1];
A2(2,1:4) = [k(3,1) k(3,2) k(3,3) 1];
A2(3,1:4) = [k(6,1) k(6,2) k(6,3) 1];
A2(4,1:4) = [k(7,1) k(7,2) k(7,3) 1];

%matrix F
f2=[];
f2(1,:) =[sqrt((k(2,1)-f(2,1))^2+(k(2,2)-f(2,2))^2+(k(2,3)-f(2,3))^2)];
f2(2,:) =[sqrt((k(3,1)-f(3,1))^2+(k(3,2)-f(3,2))^2+(k(3,3)-f(3,3))^2)];
f2(3,:) =[sqrt((k(6,1)-f(2,1))^2+(k(6,2)-f(2,2))^2+(k(6,3)-f(2,3))^2)];
f2(4,:) =[sqrt((k(7,1)-f(3,1))^2+(k(7,2)-f(3,2))^2+(k(7,3)-f(3,3))^2)];

%nilai bobot P=1;
%matrix X2 = A2,B2,C2,D2,

X2=(inv(A2'*A2))*(A2'*f2);

%-------------------------------------------------------------------

% bidang tiga titik 3 4 7 8
%matrix desain A
A3=[];
A3(1,1:4) = [k(3,1) k(3,2) k(3,3) 1];
A3(2,1:4) = [k(4,1) k(4,2) k(4,3) 1];
A3(3,1:4) = [k(7,1) k(7,2) k(7,3) 1];
A3(4,1:4) = [k(8,1) k(8,2) k(8,3) 1];

%matrix F
f3=[];
f3(1,:) =[sqrt((k(3,1)-f(3,1))^2+(k(3,2)-f(3,2))^2+(k(3,3)-f(3,3))^2)];
f3(2,:) =[sqrt((k(4,1)-f(4,1))^2+(k(4,2)-f(4,2))^2+(k(4,3)-f(4,3))^2)];
f3(3,:) =[sqrt((k(7,1)-f(3,1))^2+(k(7,2)-f(3,2))^2+(k(7,3)-f(3,3))^2)];
f3(4,:) =[sqrt((k(8,1)-f(4,1))^2+(k(8,2)-f(4,2))^2+(k(8,3)-f(4,3))^2)];

%nilai bobot P=1;
%matrix X2 = A3,B3,C3,D3,

X3=(inv(A3'*A3))*(A3'*f3);

%-------------------------------------------------------------------

% bidang empat titik 1 4 5 8
%matrix desain A
A4=[];
A4(1,1:4) = [k(1,1) k(1,2) k(1,3) 1];
A4(2,1:4) = [k(4,1) k(4,2) k(4,3) 1];
A4(3,1:4) = [k(5,1) k(5,2) k(5,3) 1];
A4(4,1:4) = [k(8,1) k(8,2) k(8,3) 1];

%matrix F
f4=[];
f4(1,:) =[sqrt((k(1,1)-f(1,1))^2+(k(1,2)-f(1,2))^2+(k(1,3)-f(1,3))^2)];
f4(2,:) =[sqrt((k(4,1)-f(4,1))^2+(k(4,2)-f(4,2))^2+(k(4,3)-f(4,3))^2)];
f4(3,:) =[sqrt((k(5,1)-f(1,1))^2+(k(5,2)-f(1,2))^2+(k(5,3)-f(1,3))^2)];
f4(4,:) =[sqrt((k(8,1)-f(4,1))^2+(k(8,2)-f(4,2))^2+(k(8,3)-f(4,3))^2)];

%nilai bobot P=1;
%matrix X4 = A4,B4,C4,D4,

X4=(inv(A4'*A4))*(A4'*f4);

%-------------------------------------------------------------------

% bidang lima titik 1 2 5 6
%matrix desain A
A5=[];
A5(1,1:4) = [k(1,1) k(1,2) k(1,3) 1];
A5(2,1:4) = [k(2,1) k(2,2) k(2,3) 1];
A5(3,1:4) = [k(5,1) k(5,2) k(5,3) 1];
A5(4,1:4) = [k(6,1) k(6,2) k(6,3) 1];

%matrix F
f5=[];
f5(1,:) =[sqrt((k(1,1)-f(1,1))^2+(k(1,2)-f(1,2))^2+(k(1,3)-f(1,3))^2)];
f5(2,:) =[sqrt((k(2,1)-f(2,1))^2+(k(2,2)-f(2,2))^2+(k(2,3)-f(2,3))^2)];
f5(3,:) =[sqrt((k(5,1)-f(1,1))^2+(k(5,2)-f(1,2))^2+(k(5,3)-f(1,3))^2)];
f5(4,:) =[sqrt((k(6,1)-f(2,1))^2+(k(6,2)-f(2,2))^2+(k(6,3)-f(2,3))^2)];

%nilai bobot P=1;
%matrix X5 = A5,B5,C5,D5,

X5=(inv(A5'*A5))*(A5'*f5);

%-------------------------------------------------------------------

% bidang enam titik 5 6 7 8
%matrix desain A
A6=[];
A6(1,1:4) = [k(5,1) k(5,2) k(5,3) 1];
A6(2,1:4) = [k(6,1) k(6,2) k(6,3) 1];
A6(3,1:4) = [k(7,1) k(7,2) k(7,3) 1];
A6(4,1:4) = [k(8,1) k(8,2) k(8,3) 1];

%matrix F
f6=[];
f6(1,:) =[sqrt((k(5,1)-f(1,1))^2+(k(5,2)-f(1,2))^2+(k(5,3)-f(1,3))^2)];
f6(2,:) =[sqrt((k(6,1)-f(2,1))^2+(k(6,2)-f(2,2))^2+(k(6,3)-f(2,3))^2)];
f6(3,:) =[sqrt((k(7,1)-f(3,1))^2+(k(7,2)-f(3,2))^2+(k(7,3)-f(3,3))^2)];
f6(4,:) =[sqrt((k(8,1)-f(4,1))^2+(k(8,2)-f(4,2))^2+(k(8,3)-f(4,3))^2)];

%nilai bobot P=1;
%matrix X6 = A6,B6,C6,D6,

X6=(inv(A6'*A6))*(A6'*f6);

%-------------------------------------------------------------------

%------------------------step 2-------------------------------------
% adjustment for all planes
% vi = Ajdxi + Bjdyi + Cjdzi +(Ajxi + Bjyi + Cjzi + Dj) ; Pj
% bobot P = 1
% parameter dxi , dyi , dzi
% adjustment orthogonality

% vj = (deltaxj+1,j-deltaxj,j-1)dxj + (deltayj+1,j-deltayj,j-1)dyj +
% deltayj+1,j*deltayj,j-1 + deltaxj+1,j*deltaxj,j-1 ; pj
% parameter dxj , dyj
%-------------------------------------------------------------------
%persamaan bidang untuk semua bidang ( 6 bidang )

A = zeros(32,24);

% titik 1
A(1,1:3) = [X1(1,1) X1(2,1) X1(3,1)];
A(2,1:3) = [X4(1,1) X4(2,1) X4(3,1)];
A(3,1:3) = [X5(1,1) X5(2,1) X5(3,1)];

% titik 2
A(4,4:6) = [X1(1,1) X1(2,1) X1(3,1)];
A(5,4:6) = [X2(1,1) X2(2,1) X2(3,1)];
A(6,4:6) = [X5(1,1) X5(2,1) X5(3,1)];

% titik 3
A(7,7:9) = [X1(1,1) X1(2,1) X1(3,1)];
A(8,7:9) = [X2(1,1) X2(2,1) X2(3,1)];
A(9,7:9) = [X3(1,1) X3(2,1) X3(3,1)];

% titik 4
A(10,10:12) = [X1(1,1) X1(2,1) X1(3,1)];
A(11,10:12) = [X3(1,1) X3(2,1) X3(3,1)];
A(12,10:12) = [X4(1,1) X4(2,1) X4(3,1)];

% titik 5
A(13,13:15) = [X4(1,1) X4(2,1) X4(3,1)];
A(14,13:15) = [X5(1,1) X5(2,1) X5(3,1)];
A(15,13:15) = [X6(1,1) X6(2,1) X6(3,1)];

% titik 6
A(16,16:18) = [X2(1,1) X2(2,1) X2(3,1)];
A(17,16:18) = [X5(1,1) X5(2,1) X5(3,1)];
A(18,16:18) = [X6(1,1) X6(2,1) X6(3,1)];

% titik 7
A(19,19:21) = [X2(1,1) X2(2,1) X2(3,1)];
A(20,19:21) = [X3(1,1) X3(2,1) X3(3,1)];
A(21,19:21) = [X6(1,1) X6(2,1) X6(3,1)];

% titik 8
A(22,22:24) = [X3(1,1) X3(2,1) X3(3,1)];
A(23,22:24) = [X4(1,1) X4(2,1) X4(3,1)];
A(24,22:24) = [X6(1,1) X6(2,1) X6(3,1)];

%-------------------------------------------------------------------
%persamaan sudut antara dua vektor

% proyeksi ke bidang referensi k - f

kf=[];

kf(1,:) = [(k(1,1)-f(1,1)) (k(1,2)-f(1,2))];

kf2=[];

kf2(1,:) = [kf(1,1) kf(1,2)];
kf2(2,:) = [(k(2,1)-kf(1,1)) (k(2,2)-kf(1,2))];
kf2(3,:) = [(k(3,1)-kf(1,1)) (k(3,2)-kf(1,2))];
kf2(4,:) = [(k(4,1)-kf(1,1)) (k(4,2)-kf(1,2))];
kf2(5,:) = [(k(5,1)-kf(1,1)) (k(5,2)-kf(1,2))];
kf2(6,:) = [(k(6,1)-kf(1,1)) (k(6,2)-kf(1,2))];
kf2(7,:) = [(k(7,1)-kf(1,1)) (k(7,2)-kf(1,2))];
kf2(8,:) = [(k(8,1)-kf(1,1)) (k(8,2)-kf(1,2))];

%---------------------------------------------------------------------
%sudut bidang referensi
%sudut 412
data1=[0 0 20 0 0 0 0 20];
beta1=deg2rad(angle2d(data1));
%---------------------------------------------------------------------
%sudut 321
data2=[20 0 20 20 20 0 0 0];
beta2=deg2rad(angle2d(data2));
%---------------------------------------------------------------------
%sudut 432
data3=[20 20 0 20 20 20 20 0];
beta3=deg2rad(angle2d(data3));
%---------------------------------------------------------------------
%sudut 341
data4=[0 20 0 0 0 20 20 20];
beta4=deg2rad(angle2d(data4));
%---------------------------------------------------------------------

%sudut bidang pengukuran titik 1 2 3 4
%sudut 412
datak1=[k(1,1) k(1,2) k(2,1) k(2,2) k(1,1) k(1,2) k(4,1) k(4,2)];
beta12=deg2rad(angle2d(datak1));
%---------------------------------------------------------------------
%sudut 321
datak2=[k(2,1) k(2,2) k(3,1) k(3,2) k(2,1) k(2,2) k(1,1) k(1,2)];
beta22=deg2rad(angle2d(datak2));
%---------------------------------------------------------------------
%sudut 432
datak3=[k(3,1) k(3,2) k(4,1) k(4,2) k(3,1) k(3,2) k(2,1) k(2,2)];
beta32=deg2rad(angle2d(datak3));
%---------------------------------------------------------------------
%sudut 341
datak4=[k(4,1) k(4,2) k(1,1) k(1,2) k(4,1) k(4,2) k(3,1) k(3,2)];
beta42=deg2rad(angle2d(datak4));
%---------------------------------------------------------------------

%sudut bidang pengukuran titik 5 6 7 8
%sudut 856
datak5=[k(5,1) k(5,2) k(6,1) k(6,2) k(5,1) k(5,2) k(8,1) k(8,2)];
beta5=deg2rad(angle2d(datak5));
%---------------------------------------------------------------------
%sudut 765
datak6=[k(6,1) k(6,2) k(7,1) k(7,2) k(6,1) k(6,2) k(5,1) k(5,2)];
beta6=deg2rad(angle2d(datak6));
%---------------------------------------------------------------------
%sudut 876
datak7=[k(7,1) k(7,2) k(8,1) k(8,2) k(7,1) k(7,2) k(6,1) k(6,2)];
beta7=deg2rad(angle2d(datak7));
%---------------------------------------------------------------------
%sudut 785
datak8=[k(8,1) k(8,2) k(5,1) k(5,2) k(8,1) k(8,2) k(7,1) k(7,2)];
beta8=deg2rad(angle2d(datak8));
%---------------------------------------------------------------------

%orthogonality
% vj = (deltaxj+1,j-deltaxj,j-1)dxj + (deltayj+1,j-deltayj,j-1)dyj +
% deltayj+1,j*deltayj,j-1 + deltaxj+1,j*deltaxj,j-1 ; pj
% parameter dxj , dyj

A(25,1:3) = [((kf2(1,1)-kf2(4,1))-(kf2(2,1)-kf2(1,1))) ((kf2(1,2)-kf2(4,2))-(kf2(2,2)-k(1,2))) 0];
A(26,4:6) = [((kf2(2,1)-kf2(1,1))-(kf2(3,1)-kf2(2,1))) ((kf2(2,2)-kf2(1,2))-(kf2(3,2)-k(2,2))) 0];
A(27,7:9) = [((kf2(3,1)-kf2(2,1))-(kf2(4,1)-kf2(3,1))) ((kf2(3,2)-kf2(2,2))-(kf2(4,2)-k(3,2))) 0];
A(28,10:12) = [((kf2(4,1)-kf2(3,1))-(kf2(1,1)-kf2(4,1))) ((kf2(4,2)-kf2(3,2))-(kf2(1,2)-k(4,2))) 0];
A(29,13:15) = [((kf2(5,1)-kf2(8,1))-(kf2(6,1)-kf2(5,1))) ((kf2(5,2)-kf2(8,2))-(kf2(6,2)-k(5,2))) 0];
A(30,16:18) = [((kf2(6,1)-kf2(5,1))-(kf2(7,1)-kf2(6,1))) ((kf2(6,2)-kf2(5,2))-(kf2(7,2)-k(6,2))) 0];
A(31,19:21) = [((kf2(7,1)-kf2(6,1))-(kf2(8,1)-kf2(7,1))) ((kf2(7,2)-kf2(6,2))-(kf2(8,2)-k(7,2))) 0];
A(32,22:24) = [((kf2(8,1)-kf2(7,1))-(kf2(5,1)-kf2(8,1))) ((kf2(8,2)-kf2(7,2))-(kf2(5,2)-k(8,2))) 0];

f7=[];

f7(1,:) = [f1(1,1)-((X1(1,1)*k(1,1))+(X1(2,1)*k(1,2))+(X1(3,1)*k(1,3))+X1(4,1))];
f7(2,:) = [f1(1,1)-((X4(1,1)*k(1,1))+(X4(2,1)*k(1,2))+(X4(3,1)*k(1,3))+X4(4,1))];
f7(3,:) = [f1(1,1)-((X5(1,1)*k(1,1))+(X5(2,1)*k(1,2))+(X5(3,1)*k(1,3))+X5(4,1))];
f7(4,:) = [f1(2,1)-((X1(1,1)*k(2,1))+(X1(2,1)*k(2,2))+(X1(3,1)*k(2,3))+X1(4,1))];
f7(5,:) = [f1(2,1)-((X2(1,1)*k(2,1))+(X2(2,1)*k(2,2))+(X2(3,1)*k(2,3))+X2(4,1))];
f7(6,:) = [f1(2,1)-((X5(1,1)*k(2,1))+(X5(2,1)*k(2,2))+(X5(3,1)*k(2,3))+X5(4,1))];
f7(7,:) = [f1(3,1)-((X1(1,1)*k(3,1))+(X1(2,1)*k(3,2))+(X1(3,1)*k(3,3))+X1(4,1))];
f7(8,:) = [f1(3,1)-((X2(1,1)*k(3,1))+(X2(2,1)*k(3,2))+(X2(3,1)*k(3,3))+X2(4,1))];
f7(9,:) = [f1(3,1)-((X3(1,1)*k(3,1))+(X3(2,1)*k(3,2))+(X3(3,1)*k(3,3))+X3(4,1))];
f7(10,:) = [f1(4,1)-((X1(1,1)*k(4,1))+(X1(2,1)*k(4,2))+(X1(3,1)*k(4,3))+X1(4,1))];
f7(11,:) = [f1(4,1)-((X3(1,1)*k(4,1))+(X3(2,1)*k(4,2))+(X3(3,1)*k(4,3))+X3(4,1))];
f7(12,:) = [f1(4,1)-((X4(1,1)*k(4,1))+(X4(2,1)*k(4,2))+(X4(3,1)*k(4,3))+X4(4,1))];
f7(13,:) = [f6(1,1)-((X4(1,1)*k(5,1))+(X4(2,1)*k(5,2))+(X4(3,1)*k(5,3))+X4(4,1))];
f7(14,:) = [f6(1,1)-((X5(1,1)*k(5,1))+(X5(2,1)*k(5,2))+(X5(3,1)*k(5,3))+X5(4,1))];
f7(15,:) = [f6(1,1)-((X6(1,1)*k(5,1))+(X6(2,1)*k(5,2))+(X6(3,1)*k(5,3))+X6(4,1))];
f7(16,:) = [f6(2,1)-((X2(1,1)*k(6,1))+(X2(2,1)*k(6,2))+(X2(3,1)*k(6,3))+X2(4,1))];
f7(17,:) = [f6(2,1)-((X5(1,1)*k(6,1))+(X5(2,1)*k(6,2))+(X5(3,1)*k(6,3))+X5(4,1))];
f7(18,:) = [f6(2,1)-((X6(1,1)*k(6,1))+(X6(2,1)*k(6,2))+(X6(3,1)*k(6,3))+X6(4,1))];
f7(19,:) = [f6(3,1)-((X2(1,1)*k(7,1))+(X2(2,1)*k(7,2))+(X2(3,1)*k(7,3))+X2(4,1))];
f7(20,:) = [f6(3,1)-((X3(1,1)*k(7,1))+(X3(2,1)*k(7,2))+(X3(3,1)*k(7,3))+X3(4,1))];
f7(21,:) = [f6(3,1)-((X6(1,1)*k(7,1))+(X6(2,1)*k(7,2))+(X6(3,1)*k(7,3))+X6(4,1))];
f7(22,:) = [f6(4,1)-((X3(1,1)*k(8,1))+(X3(2,1)*k(8,2))+(X3(3,1)*k(8,3))+X3(4,1))];
f7(23,:) = [f6(4,1)-((X4(1,1)*k(8,1))+(X4(2,1)*k(8,2))+(X4(3,1)*k(8,3))+X4(4,1))];
f7(24,:) = [f6(4,1)-((X6(1,1)*k(8,1))+(X6(2,1)*k(8,2))+(X6(3,1)*k(8,3))+X6(4,1))];


%-----------------------------------------------------------------------

f7(25,:) = [(beta1-beta12)-(((kf2(1,1)-kf2(4,1))*(kf2(2,1)-kf2(1,1)))+((kf2(1,2)-kf2(4,2))*(kf2(2,2)-k(1,2))))];
f7(26,:) = [(beta2-beta22)-(((kf2(2,1)-kf2(1,1))*(kf2(3,1)-kf2(2,1)))+((kf2(2,2)-kf2(1,2))*(kf2(3,2)-k(2,2))))];
f7(27,:) = [(beta3-beta32)-(((kf2(3,1)-kf2(2,1))*(kf2(4,1)-kf2(3,1)))+((kf2(3,2)-kf2(2,2))*(kf2(4,2)-k(3,2))))];
f7(28,:) = [(beta4-beta42)-(((kf2(4,1)-kf2(3,1))*(kf2(1,1)-kf2(4,1)))+((kf2(4,2)-kf2(3,2))*(kf2(1,2)-k(4,2))))];
f7(29,:) = [(beta1-beta5)-(((kf2(5,1)-kf2(8,1))*(kf2(6,1)-kf2(5,1)))+((kf2(5,2)-kf2(8,2))*(kf2(6,2)-k(5,2))))];
f7(30,:) = [(beta2-beta6)-(((kf2(6,1)-kf2(5,1))*(kf2(7,1)-kf2(6,1)))+((kf2(6,2)-kf2(5,2))*(kf2(7,2)-k(6,2))))];
f7(31,:) = [(beta3-beta7)-(((kf2(7,1)-kf2(6,1))*(kf2(8,1)-kf2(7,1)))+((kf2(7,2)-kf2(6,2))*(kf2(8,2)-k(7,2))))];
f7(32,:) = [(beta4-beta8)-(((kf2(8,1)-kf2(7,1))*(kf2(5,1)-kf2(8,1)))+((kf2(8,2)-kf2(7,2))*(kf2(5,2)-k(8,2))))];
%hasil pengolahan menggunakan least square adjustment
%X7 = hasil dari perhitungan menggunakan formula di atas step 1 dan step 2 (koreksi)
%yp = koordinat kubus yang akan di hitung dengan menggunakan metode least square adjustment
%x8 = koreksi - koordinat awal kubus
%x9 = acuan baru setelah dihitung dengan menggunakan least square adjustment
X7=(inv(A'*A))*(A'*f7)
yp=[k(1,:)'
k(2,:)'
k(3,:)'
k(4,:)'
k(5,:)'
k(6,:)'
k(7,:)'
k(8,:)'];
x8 = X7-yp;
X8=[x8(1,1) x8(2,1) x8(3,1)
    x8(4,1) x8(5,1) x8(6,1)
    x8(7,1) x8(8,1) x8(9,1)
    x8(10,1) x8(11,1) x8(12,1)
    x8(13,1) x8(14,1) x8(15,1)
    x8(16,1) x8(17,1) x8(18,1)
    x8(19,1) x8(20,1) x8(21,1)
    x8(22,1) x8(23,1) x8(24,1)];
x9=[k(1,1) k(1,2) k(1,3)
    k(2,1) k(2,2) k(2,3)
    k(3,1) k(3,2) k(3,3)
    k(4,1) k(4,2) k(4,3)];
%bagian save ini diisi dengan nama file selanjutnya , dengan mengganti number belakang dari nama file , contoh : iterasi2.txt, iterasi3.txt , dan seterusnya
%begitu pun dengan acuan .
save iterasi2.txt X8 -ASCII
save acuan2.txt x9 -ASCII

%untuk selanjutnya pada bagian step 1 , iterasi1.txt diganti dengan iterasi2.txt , acuan.txt diganti dengan acuan2.txt
%begitu seterusnya hingga mendapat nilai yang konstan

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us