function [DATAPI,DATANSP]=kldaforspeech(DATA1,DATA2, kerneltype)
%DATA1 and DATA2 are the cells, with each cell belongs to the individual cluster 
%DATA1 belongs to the tranining data and DATA2 belongs to the testing data
% kerneltype
% 1-Innerproduct: kerneltype
% 2-Gaussian kerneltype
% 3-Polynomial kerneltype
% 4-Power exponential kerneltype
% 5-Hyperbolic tangent
% 6- Cauchy
% 7-Inverse multi-quadric

DATA11=cell2mat(DATA1);
DATA22=cell2mat(DATA2);
kerneltype=1
switch kerneltype
    case 1
%Formation of training set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TRDATA(j,i)=k00(DATA11(:,i),DATA11(:,j));
    end
end
%Formation of testing set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TEDATA(j,i)=k00(DATA22(:,i),DATA11(:,j));
    end   
end
    case 2
%Formation of training set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TRDATA(j,i)=k11(DATA11(:,i),DATA11(:,j),0.01);
    end
end
%Formation of testing set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TEDATA(j,i)=k11(DATA22(:,i),DATA11(:,j),0.01);
    end   
end
    case 3
%Formation of training set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TRDATA(j,i)=k22(DATA11(:,i),DATA11(:,j),0.1,0.1);
    end
end
%Formation of testing set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TEDATA(j,i)=k22(DATA22(:,i),DATA11(:,j),0.1,0.1);
    end   
end
    case 4
%Formation of training set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TRDATA(j,i)=k33(DATA11(:,i),DATA11(:,j),0.1,0.1);
    end
end
%Formation of testing set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TEDATA(j,i)=k33(DATA22(:,i),DATA11(:,j),0.1,0.1);
    end   
end
    case 5
%Formation of training set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TRDATA(j,i)=k44(DATA11(:,i),DATA11(:,j),0.1,0.1);
    end
end
%Formation of testing set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TEDATA(j,i)=k44(DATA22(:,i),DATA11(:,j),0.1,0.1);
    end   
end
    case 6
%Formation of training set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TRDATA(j,i)=k55(DATA11(:,i),DATA11(:,j),0.1);
    end
end
%Formation of testing set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TEDATA(j,i)=k55(DATA22(:,i),DATA11(:,j),0.1);
    end   
end
    case 7
%Formation of training set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TRDATA(j,i)=k66(DATA11(:,i),DATA11(:,j),0.1);
    end
end
%Formation of testing set
for i=1:1:size(DATA11,2)
    for j=1:1:size(DATA11,2)
TEDATA(j,i)=k66(DATA22(:,i),DATA11(:,j),0.1);
    end   
end
end
for i=1:1:3
DTR{i}=TRDATA(:,(i-1)*5+1:1:(i-1)*5+5);
end
for i=1:1:3
DTE{i}=TRDATA(:,(i-1)*5+1:1:(i-1)*5+5);
end
[E,E2,DATAPI,DATANSP]=ldaforspeech1(DTR);
DATAPI=E'*cell2mat(DTE)
figure
subplot(2,2,1)
plot(DATAPI(1,1:1:5),zeros(1,length(DATAPI(1,1:1:5))),'r*')
hold on
plot(DATAPI(1,6:1:10),zeros(1,length(DATAPI(1,6:1:10))),'gs')
plot(DATAPI(1,11:1:15),zeros(1,length(DATAPI(1,11:1:15))),'bd')
if(size(E,2)>1)
subplot(2,2,2)
plot(DATAPI(1,1:1:5),DATAPI(2,1:1:5),'r*')
hold on
plot(DATAPI(1,6:1:10),DATAPI(2,6:1:10),'gs')
plot(DATAPI(1,11:1:15),DATAPI(2,11:1:15),'bd')
end
DATANSP=E2'*cell2mat(DTE);
subplot(2,2,3)
plot(DATANSP(1,1:1:5),zeros(1,length(DATANSP(1,1:1:5))),'r*')
hold on
plot(DATANSP(1,6:1:10),zeros(1,length(DATANSP(1,6:1:10))),'gs')
plot(DATANSP(1,11:1:15),zeros(1,length(DATANSP(1,11:1:15))),'bd')
if(size(E2,2)>1)
subplot(2,2,4)
plot(DATANSP(1,1:1:5),DATANSP(2,1:1:5),'r*')
hold on
plot(DATANSP(1,6:1:10),DATANSP(2,6:1:10),'gs')
plot(DATANSP(1,11:1:15),DATANSP(2,11:1:15),'bd')
end



