clear all
clf
clc

%HERE ARE THE DATA 
xo=; %e.g., xo=120;
yo=;

xx1=[]; %e.g., xx1=[100,110,120];
yy1=[];

xx2=[];
yy2=[];

xx3=[];
yy3=[];

xx4=[];
yy4=[];

tim=[]; %e.g., tim=[2001,2002,2003]

x1=0.25*(xx1+xx2+xx3+xx4)-xo;
y1=0.25*(yy1+yy2+yy3+yy4)-yo;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

No=length(tim);
set(gca,'Ydir','Reverse');

figure(1)
plot(tim,xx1-xo,'+b',tim,xx2-xo,'+b',tim,xx3-xo,'+b',tim,xx4-xo,'+b',tim,x1,'or');
title('check the data of xx for large discrepancies')
xlabel('time (year)')
ylabel('\Delta x')
hold off

figure(2)
plot(tim,yy1-yo,'+b',tim,yy2-yo,'+b',tim,yy3-yo,'+b',tim,yy4-yo,'+b',tim,y1,'or')
title('check the data of yy for large discrepancies')
xlabel('time (year)')
ylabel('\Delta y')
hold off


% THE x1,y1, and tim arrays are stored in test.mat file
DAT=[x1;y1;tim];
 save( 'DATAfile.mat', 'DAT');
 
 
 
% A = fscanf(test.mat,formatSpec)

