Vous êtes sur la page 1sur 13

TUGAS 1

TEKNIK ANALISIS DATA


Andrian Pratama S. (15109066), Nabila Sofia E. P. (15109086)
Program Studi Magister Teknik Geodesi dan Geomatika
Fakultas Ilmu dan Teknologi Kebumian
Institut Teknologi Bandung
andrian.pratamas@gmail.com, nabila.sofia@gmail.com

TASKS 1: Linear fitting zwd-pwv


Relation between zwd and pwv may be presented by the following equation:
zwd = a x pwv + b
Plot zwd against pwv to see correlation between them.
We used Matlab to solve the problem. Make sure the file *.m is in the same directory with ztd_pwv file.

%Loading the data


load ztd_pwv
%Inputing the zwd and pwv data
zwd=ztd_pwv(:,1);
pwv=ztd_pwv(:,2);
%Plotting the relation between zwd and pwv
plot(pwv,zwd,'.')
Result:
380

360

340

320
Zenith Water Delay (ZWD)

1)

300

280

260

240

220

200
30

35

40

45
50
Precipitable Water Vapor (PWV)

55

60

65

2)

Apply standard least-square technique to estimate a and b.


To solve the problem, we make a function. The function composed by:
function x = Tasks1no2(pwv,zwd)
%Constructing the matrix
L=zwd;
A(length(pwv),2)=0;
A(:,2)=1;
A(:,1)=pwv;
P = 1; %Weight matrix
%Determining the parameter matrix with standard least square
X=inv(A'*P*A)*A'*P*L;;
a=X(1)
b=X(2)
end
To use the function, just type (in Command Window):
Tasks1no2(pwv,zwd)
Result:

3)

Estimate precision of a and b and their correlation.


We can estimated the precision of a and b and their correlation by determine the variance-covariance
matrix. To solve the problem, we make a function. The function composed by:
function x = Tasks1no3(pwv,zwd)
%Constructing the matrix
L=zwd;
A(length(pwv),2)=0;
A(:,2)=1;
A(:,1)=pwv;
P = 1; %Weight matrix
%Determining the parameter matrix with standard least square
X=inv(A'*P*A)*A'*P*L;
%Estimate precision
V=A*X-L;
2

Sigma=(V'*V)/(length(pwv)-length(X));
Qxx=inv(A'*A);
Sigmaxx=Sigma*Qxx
end
To use the function, just type (in Command Window):
Tasks1no3(pwv,zwd)
Result:

4)

Determine magnitude of correlation between zwd and pwv (use corrcoef command in Matlab).
The command:
%Determine magnitude of correlation between zwd and pwv
corrcoef(pwv,zwd)
Result:

TASKS 2: Linear fitting height-pressure


Relation between height h and pressure p may be presented by the following equation:
h= exp(-ap) + b
1)

Plot h against p to see correlation between them.


We used Matlab to solve the problem. Make sure the file *.m is in the same directory with height_pwv file.
%Loading the data
load height_pwv;
%Inputing the p and h data
p = height_pwv(:,1);
h = height_pwv(:,2);
%Plotting the relation between p and h
plot(p,h,'.')
Result:
3.9

3.8

3.7

3.6

Height

3.5

3.4

3.3

3.2

3.1

2)

10

20

30

40

50
Pressure

60

70

Apply standard least-square technique to estimate a and b.


To solve the problem, we make a function. The function composed by:
We use approximation of b = 3, so get a = 0.1985.
function x = Tasks2no2(height_pwv)
p = height_pwv(:,1);
h = height_pwv(:,2);
anol=0.1985;
bnol=3;
%Doing iteration
for iteration=1:10
%Constructing Matrix A
for i=1:length(p);
A(i,1)=-p(i)*exp(1)^(-anol*p(i));
A(i,2)=1;
4

80

90

100

end
%Constructing Matrix Ln
for i=1:length(h);
L(i,1)=h(i)-(exp(1)^(-anol*p(i))+bnol);
end
%Constructing Matrix P (Weight)
P=1;
%Determining Parameter
X=inv(A'*P*A)*(A'*P*L);
a=0.1985+X(1);
b=3+X(2);
anol=a;
bnol=b;
end
%Show the result
a
b
iteration
end
To use the function, just type (in Command Window):
Tasks2no2(height_pwv)
Result:

3)

Estimate precision of a and b and their correlation.


To solve the problem, we make a function. The function composed by:
function x = Tasks2no3(height_pwv)
p = height_pwv(:,1);
h = height_pwv(:,2);
anol=0.1985;
bnol=3;
%Doing iteration
for iteration=1:10
%Constructing Matrix A
5

for i=1:length(p);
A(i,1)=-p(i)*exp(1)^(-anol*p(i));
A(i,2)=1;
end
%Constructing Matrix Ln
for i=1:length(h);
L(i,1)=h(i)-(exp(1)^(-anol*p(i))+bnol);
end
%Constructing Matrix P (Weight)
P=1;
%Determining Parameter
X=inv(A'*P*A)*(A'*P*L);
a=0.1985+X(1);
b=3+X(2);
anol=a;
bnol=b;
end
X=[a;b];
%Estimate precision
V=A*X-L;
Aposteriori=(V'*P*V)/(length(p)-length(X));
Kofaktor=inv(A'*P*A);
Sigmaxx=Aposteriori*Kofaktor
end
To use the function, just type (in Command Window):
Tasks2no3(height_pwv)
Result:

TASKS 3: Tidal wave determination


Suppose that a bi-chromatic wave can be described adequately by :
y= a cos (3 t + a) + b cos (5 t + b)
1)

Plot t against y to see correlation between them.


We used Matlab to solve the problem. Make sure the file *.m is in the same directory with wave file.
%Loading the data
load wave;
%Inputing the t and y data
t=wave(:,1);
y=wave(:,2);
%Plotting the relation between t and y
plot(t,y,'.')
Result:
5

-1

-2

-3

-4

-5

2)

0.1

0.2

0.3

0.4

0.5
t

0.6

0.7

Apply standard least-square technique to estimate a and b.


To solve the problem, we make a function. The function composed by:
function x = Tasks3no2(wave)
t=wave(:,1);
y=wave(:,2);
%Constructing Matrix
L=y;
A(length(t),4)=0;
for i=1:length(t)
A(i,1)=cos(3*pi*t(i));
A(i,2)=-sin(3*pi*t(i));
A(i,3)=cos(5*pi*t(i));
A(i,4)=-sin(5*pi*t(i));
end

0.8

0.9

%Matrix P (weight)
P=1;
%Determining Matrik X
X=inv(A'*P*A)*(A'*P*L);
%Determine a and b
a=sqrt(X(1)^2+X(2)^2)
b=sqrt(X(3)^2+X(4)^2)
end
To use the function, just type (in Command Window):
Tasks3no2(wave)
Result:

3)

Determine the phase of each wave component ( a and b)


To solve the problem, we make a function. The function composed by:
function x = Tasks3no3(wave)
t=wave(:,1);
y=wave(:,2);
%Constructing Matrix
L=y;
A(length(t),4)=0;
for i=1:length(t)
A(i,1)=cos(3*pi*t(i));
A(i,2)=-sin(3*pi*t(i));
A(i,3)=cos(5*pi*t(i));
A(i,4)=-sin(5*pi*t(i));
end
%Matrix P (weight)
8

P=1;
%Determining Matrik X
X=inv(A'*P*A)*(A'*P*L);
%Determining a and b
a=sqrt(X(1)^2+X(2)^2);
b=sqrt(X(3)^2+X(4)^2);
%Determining Phase A dan Phase B
PhiA=rad2deg(atan(X(2)/X(1)))
PhiB=rad2deg(atan(X(4)/X(3)))
end
To use the function, just type (in Command Window):
Tasks3no3(wave)
Result:

TASKS 4: Adjustment of Leveling Network


PT NuGelo (Nusantara Geo-location) just accomplished leveling measurements on a local vertical network. Due
to some problems, the measurements were separated into two phases (unit in meter).

1)

Apply standard least-square (SLS) technique to calculate the height of points B, C and D based on the
network of phase 1.
We used Matlab to solve the problem.
% Applying standard least square technique to determine unknown
parameters
% of phase 1, in this case, B, C, and D.
%Inputing the Matrix A
A1=[1 0 0;-1 1 0;0 -1 1;0 0 -1];
%Inputing the Matrix L
L1=[448.105;5.360;-8.523;-444.944];
%Inputing the Matrix P (Weight)
P1=diag([(1/0.006^2);(1/0.004^2);(1/0.005^2);(1/0.003^2)]);
%Determine Matrix X (Parameter)
x1=(inv(A1'*P1*A1))*(A1'*P1*L1);
%Showing the results
B1=x1(1,:)
C1=x1(2,:)
D1=x1(3,:)
Result:

10

2)

Using the same technique as in task 1, calculate the height of points B, C and D based on the network of
phase 2.
% Applying standard least square technique to determine unknown
parameter
% of phase 2, in this case, B, C, and D.
%Inputing the Matrix A
A2=[1 0 0;-1 1 0;0 -1 1;0 0 -1;-1 0 1;0 1 0];
%Inputing the Matrix L
L2=[448.105;5.360;-8.523;-444.944;-3.167;453.477];
%Inputing the Matrix P (Weight)
P2=diag([(1/0.006^2);(1/0.004^2);(1/0.005^2);(1/0.003^2);(1/0.004^2);
(1/0.012^2)]);
%Determine Matrix X (Parameter)
x2=(inv(A2'*P2*A2))*(A2'*P2*L2);
%Showing the results
B2=x2(1,:)
C2=x2(2,:)
D2=x2(3,:)
Result:

3)

Compare the results of tasks 1 and 2 and discuss the accuracy of the calculated height.
The result of the both of the phases are slightly different, we determined the accuracy of the phases by
determine the variance-covariance matrix of the phases.
% The accuracy of the calculated height.
% For phase 1
n_1=length(A_1);
u_1=length(x_1);
V_1=(A_1*x_1)-L_1;
Qxx_1=(inv(A_1'*P_1*A_1));
sigmaxx_1=(V_1'*P_1*V_1)/(n_1-u_1);
variance_covariance_1=sigmaxx_1*Qxx_1
% For phase 2
n_2=length(A_2);
u_2=length(x_2);
11

V_2=(A_2*x_2)-L_2;
Qxx_2=(inv(A_2'*P_2*A_2));
sigmaxx_2=(V_2'*P_2*V_2)/(n_2-u_2);
variance_covariance_2=sigmaxx_2*Qxx_2
Result:

As we have seen, phase 1 has a smaller variance value. It proves the phase 1 has better accuracy. this can
be caused by poor measurement in phase 2.

4)

Apply recursive least-square (RLS) technique to calculate the height of points B, C and D based on the
network of phases 1 and 2.
%Using recursive least square to calculate B, C, and D for phase 2.
K2=(inv((inv(Qxx1))+(A2'*P2*A2)))*A2'*P2;
dx2=K2*(L2-(A2*x1));
xR2=dx2+x1;
Brecursive=xR2(1,:)
Crecursive=xR2(2,:)
Drecursive=xR2(3,:)

Result:

12

5)

Compare the results of tasks 2 and 4 and discuss the accuracy of the calculated height.
% Show accuracy of height with using B, C, and D standard least square.
variance_covariance2
% Calculating accuracy of height with using B, C, and D recursive least
square.
VR2=(A2*xR2)-L2;
sigmaxxR2=(VR2'*P2*VR2)/(n2-u2);
variance_covarianceR2=sigmaxxR2*Qxx2
Result:

There are some differences in accuracy between phase 2 using standard least squares with phase 2 that uses
recursive least squares. From these results we see that using the standard least squares have better
accuracy. But the difference in accuracy between the two methods are not very far away.

6)

What are the advantages of using RLS for the above cases?
The advantages of using recursive least squares are we can perform calculations faster and saving the
computing power. Moreover, the differences in accuracy was not too far away.

13

Vous aimerez peut-être aussi