% This code is to plot the data set and the test vectors.
%

% file : plot_o.m
%

% load the data files
%
load s1.dat;
load s2.dat;

% plot the data sets
%
hold on;
box on;
grid on;
plot(s1(:,1),s1(:,2),'k*');
plot(s2(:,1),s2(:,2),'k*');
axis([-8 8 -8 8]);
title('set1, set2 & test vectors');


% Define the test set
%
x1=[-1,-1];
x2=[0,0];
x3=[1/2,1/2];
x4=[1/2,-1/2];
[m,n] = size(s1);

% Setup files for storing the results
%
FID = fopen('set1_original','w');

% adjust the data so that the required mean is obtained
%
for k=1:m
b(k,1) = s1(k,1) - 1.2299 ;
b(k,2) = s1(k,2) + 0.2579 ;   
fprintf(FID,'%7.6f   %7.6f\n', b(k,1),b(k,2));
end;

% Calculate the mean of set1
%
mean_1 = mean(b);

[m,n] = size(s2);
% Setup files for storing the results
%
FID = fopen('set2_original','w');

% adjust the data so that the required mean is obtained
%
for k=1:m
c(k,1) = s2(k,1) -0.6351;
c(k,2) = s2(k,2) +0.8489;
fprintf(FID,'%7.6f   %7.6f\n', b(k,1),b(k,2));
end;

% Calculate the mean of set2
%
mean_2 = mean(c);

% plot the test set
%
hold on;
box on;
grid on;
plot(x1(1),x1(2),'kv');
plot(x2(1),x2(2),'kv');
plot(x3(1),x3(2),'kv');
plot(x4(1),x4(2),'kv');
axis([-5 5 -5 5]);
legend(' set 1',' set2','test vectors');

% end of file
%

