
clear;
clc;
load GM1.txt;
data = GM1(:,1:2);
labels = GM1(:,end);

MEAN=mean(data);
set(0, 'DefaultFigureVisible', 'on')
set(0,'DefaultAxesFontName', 'Times New Roman')
set(0,'DefaultAxesFontSize', 30)


%%%%%%%%%%%%%%%%%%%%%%%%%%% Plotting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h=figure;
axis square;
axis tight;
axis equal;
axis on;
Class1 = data(labels==1,:);
Class2 = data(labels==2,:);
Class1=plot(Class1(:,1),Class1(:,2),'*','MarkerSize',20,'Color',[0 0.4 0]);
hold all
Class2=plot(Class2(:,1),Class2(:,2),'o','MarkerSize',20,'Color',[0 0 0.5]);
hold all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



[V]=NLDA_mex(data, labels);
if (~isempty(V))
    NewData = data * V;
    Lest=quiver(MEAN(1),MEAN(2),V(1,1),V(2,1),10,'LineWidth',5,'Color',[136 40 5]./255);
    hold all;
    if(size(V,2)==2)
        quiver(MEAN(1),MEAN(2),V(1,2),V(2,2),10,'LineWidth',2,'Color',[136 40 5]./255);
        hold all;
        Vectors(1,:)=[MEAN(1) MEAN(2) V(1,1) V(2,1) MEAN(1) MEAN(2) V(1,2) V(2,2)];
    end
end