% clc
% clear all
% close all
% %%
% 
%  I3 = importdata('DataV.txt');
%  V = I3(:,2)  ;
% time = I3(:,1) ;
% 
%  I4 = importdata('DataN.txt');
%  N = I4(:,2)  ;
%  
% 
% W=zeros(length(N),1)  ;
% 
% MEAN = mean(N) ;
% 
% N = N - MEAN ;
% 
% %%
% ms = 20 ;
% T = 40*20 ;
% 
% c=1 ;
% p=1 ;
% 
% w=1 ;
% 
% 
% %%  Finding the spikes and the time of spiking
% % 
% % [pks , locs] = findpeaks(V,'MinPeakDistance',800, 'MinPeakHeight',0)  ;    
% % %
% % 
% % K = find( pks>0) ;  
% % %length(K)
% % 
% % %
% % for i=3:length(pks)
% %      
% %   if pks(i,1) > 0
% %         
% %   A(1,:) = V(locs(i,1)-100:locs(i,1) , 1) ;
% %   AA = A(A>=0) ;
% %   [L]=knnsearch(AA',0) ;
% %        B = AA(1,L) ;
% % 
% %        
% %   [row1]=find(V==B) ;
% %   
% %  
% %   for jjj=1:size(row1,1)
% %   if (row1(jjj,1) < locs(i,1)-5) && (row1(jjj,1) > locs(i,1)-100)
% %   row2 = row1(jjj,1) ;
% %   
% %   
% %   if V(row2) < 3
% %      S(:,c)= N(row2-T:row2,1) ;
% %        c=c+1 ;
% %        
% %        
% %      W(row2,1) = 1  ; 
% %      
% %      
% % %   plot(row2, V(row2) , '*g')
% % %   hold on  
% %      
% %   end 
% %   end      
% %   end
% % end
% % end
% %%
% % save ('S.mat' , 'S')
% % save ('W.mat' , 'W')
% %%
% 
% 
% 
% %%
% load ('S')    % Matrix S includes noise stimulus preceding each spike
% load ('W')    % Vector W includes the time of spikes (1 is spike)
% [m,n]=size(S) ;
% 
% NumberSpike = n ;
% %%
% 
% stc_Matrix = S ;
% m_s = mean(stc_Matrix,2);
% 
% 
% time = -time(1:40*20+1,1) ;
% time = sort(time) ;
% 
% 
% 
% %%
% 
% cc=1 ;
% spp = W ;
% 
% sp_binary_shuf(:,1) = Shuffle_(spp);
% 
% spike_indx = find( sp_binary_shuf >0);
% 
% maxindx = spike_indx(end);
% indx_int = find(spike_indx>T & spike_indx<maxindx-T);
% 
% for i=1:length( indx_int   )
% 
% SS(:,cc)= N( spike_indx(indx_int(i)) -T: spike_indx(indx_int(i))   ,1) ;
%        cc=cc+1 ;
%     
% end
% 
%  stc_Matrix_shuf = SS ;
% 
% %%
% 
% ccc=1 ;
% spp = W ;
% 
% sp_binary_shuf2(:,1) = Shuffle_(spp);
% 
% spike_indx2 = find( sp_binary_shuf2 >0);
% 
% maxindx2 = spike_indx2(end);
% indx_int2 = find(spike_indx2>T & spike_indx2<maxindx2-T);
% 
% for i=1:length( indx_int2   )
% 
% SSS(:,ccc)= N( spike_indx2(indx_int2(i)) -T: spike_indx2(indx_int2(i))   ,1) ;
%        ccc=ccc+1 ;
%     
% end
% 
%  stc_Matrix_shuf2 = SSS ;
% %%
% 
% C1 = zeros(m,m) ;
% 
% for j=1:NumberSpike
%     
%       C1 = C1 +  (S(:,j) - m_s) * transpose((S(:,j) - m_s)) ;
%      
% end
% 
% C1 = C1 / (NumberSpike-1) ;
% 
%  
% %% 
%  
% inp_mean = mean(stc_Matrix,2); INP_mean = repmat(inp_mean,1,size(stc_Matrix,2)); 
% inp_mean_shuf = mean(stc_Matrix_shuf,2); INP_mean_shuf = repmat(inp_mean_shuf,1,size(stc_Matrix_shuf,2)); 
% inp_mean_shuf2 = mean(stc_Matrix_shuf2,2); INP_mean_shuf2 = repmat(inp_mean_shuf2,1,size(stc_Matrix_shuf2,2));
% C_shuf2 = cov((stc_Matrix_shuf2 - INP_mean_shuf2)');
% C_shuf = cov((stc_Matrix_shuf - INP_mean_shuf)') - C_shuf2;
% %C = cov((stc_Matrix - INP_mean)') - C_shuf2;
% C = C1 - C_shuf2;
% 
% 
% [U_shuf,D_shuf] = eig(C_shuf);%[u_shuf,s_shuf,v] = svd(stc_new_shuf);
% [U,D] = eig(C);%-C_shuf);
% d = diag(D)/norm(diag(D));
% v1 = U(:,1);%
% v2 = U(:,2);%
% %v3 = U(:,2);%
% 
% 
% %%
% 
% %%
% % figure
% % plot(time,m_s/norm(m_s),'k','LineWidth',2)
% % xlabel(' t before spike (ms)')
% % legend ('STA')
% % ylim([-0.15 0.15])
%%
figure
plot(time,v2/norm(v2),'r','LineWidth',2)
hold on
plot(time,v1/norm(v1),'c','LineWidth',2)
 hold on
plot(time,m_s/norm(m_s),'k','LineWidth',2)

 




legend('feature 2','feature 1','STA' )
xlabel(' t before spike (ms)')

%%
d_shuf = diag(D_shuf)/norm(diag(D_shuf));

figure



plot(length(d):-1:1,d(1:end)/norm(d,2),'Color',[0.75 0.75 0.75], 'linestyle','none' , 'Marker', 'o')
hold on
plot(length(d_shuf):-1:1,d_shuf(1:end)/norm(d_shuf,2),'-k','LineWidth',2)
hold on

plot(801 , d(1)/norm(d,2),'oc','LineWidth',1)
plot(800 , d(2)/norm(d,2),'or','LineWidth',1)

xlabel('eigenmode index')
ylabel('eigenvalue')


%%
%[s1,s2] = proj1(v1 , v2, S+0.06 ,NumberSpike );
% 
% [s1,s2] = Projection_Vector(W, v1 , v2 , N );
% 
% [s1_shuf,s2_shuf] = Projection_Vector(sp_binary_shuf,v1,v2, N);%
% [s1_shuf2,s2_shuf2] = Projection_Vector(sp_binary_shuf2,v1,v2, N );%

figure



plot(s1_shuf,s2_shuf,'Color',[0.75 0.75 0.75], 'linestyle','none' , 'Marker', '.')
hold on
plot(s1_shuf2,s2_shuf2,'Color',[0.75 0.75 0.75], 'linestyle','none' , 'Marker', '.')

xlim([-0.2 0.2])
ylim([-0.2 0.2])

hold on

plot(s1,s2,'.k')

xlabel('Projection onto feature 1')
ylabel('Projection onto feature 2')


axis equal

% figure
% plot(diag(D_shuf),'og')
% hold on
% plot(diag(D),'or')


% %%
% 
% figure
% 
% plot(time,U(:,1598)/norm(U(:,1599)),'b','LineWidth',2)


% ssp_binary_shuf = find(sp_binary_shuf2>0)  ;
% [ss1 ss2]=Projection_ (ssp_binary_shuf, C_shuf2  , N+0.06) ;
% 
% WW=find(W>0) ;
% [s1,s2] = Projection_(WW,C,N+0.06) ;
% figure
% 
% 
% plot(ss1,ss2,'.k')
% hold on
% plot(s1,s2,'.r')


%%
% S(:,5)'
% %%
% figure
% plot(v1)
% %%
% figure
% plot(S(:,50))


%% Axial current projection onto features

Axial_current=zeros(801,1)  ;

Axial=[-3.48E-09
-2.21E-06
-2.02E-06
-1.77E-06
-1.58E-06
-1.27E-06
-8.60E-07
-4.64E-07
-2.09E-07
-1.08E-07
-8.19E-08
-7.60E-08
-7.36E-08
-7.16E-08
-6.89E-08
-6.47E-08
-5.79E-08
-4.63E-08
-2.36E-08
2.61E-08
1.10E-07
-1.30E-06
-3.12E-05
-1.59E-04
-1.59E-04
-1.58E-04
-1.58E-04
-1.56E-04
-1.54E-04
-1.52E-04
-1.50E-04
-1.48E-04
-1.37E-04
-1.02E-04
-3.01E-05
2.49E-04
-2.77E-03
2.87E-03
-9.23E-04
-1.33E-04
1.37E-03
-2.01E-04
7.24E-04
1.43E-03
1.39E-03
4.04E-03
3.52E-03
3.94E-03
2.49E-03
3.42E-03
3.62E-03
3.36E-03
5.52E-03
6.72E-03
3.85E-03
7.82E-03
7.54E-03
1.01E-02
1.19E-02
1.65E-02
1.81E-02
1.99E-02
2.57E-02
2.82E-02
3.16E-02
3.19E-02
3.71E-02
3.96E-02
4.58E-02
5.11E-02
5.77E-02
6.18E-02
6.56E-02
7.18E-02
7.58E-02
7.91E-02
8.53E-02
8.69E-02
8.99E-02
9.42E-02
9.59E-02
1.02E-01
9.98E-02
1.01E-01
1.04E-01
1.04E-01
1.06E-01
1.04E-01
1.03E-01
1.07E-01
1.09E-01
1.09E-01
1.06E-01
1.10E-01
1.07E-01
1.11E-01
1.12E-01
1.08E-01
1.13E-01
1.14E-01
1.14E-01
1.17E-01
1.17E-01
1.16E-01
1.20E-01
1.22E-01
1.22E-01
1.23E-01
1.23E-01
1.27E-01
1.26E-01
1.26E-01
1.29E-01
1.28E-01
1.30E-01
1.31E-01
1.32E-01
1.36E-01
1.35E-01
1.34E-01
1.35E-01
1.32E-01
1.36E-01
1.36E-01
1.39E-01
1.39E-01
1.38E-01
1.38E-01
1.40E-01
1.40E-01
1.39E-01
1.39E-01
1.42E-01
1.38E-01
1.41E-01
1.41E-01
1.40E-01
1.40E-01
1.43E-01
1.43E-01
1.42E-01
1.46E-01
1.45E-01
1.45E-01
1.48E-01
1.44E-01
1.44E-01
1.43E-01
1.46E-01
1.49E-01
1.47E-01
1.47E-01
1.49E-01
1.48E-01
1.47E-01
1.50E-01
1.48E-01
1.48E-01
1.53E-01
1.52E-01
1.50E-01
1.50E-01
1.52E-01
1.51E-01
1.53E-01
1.53E-01
1.55E-01
1.51E-01
1.53E-01
1.53E-01
1.51E-01
1.54E-01
1.56E-01
1.52E-01
1.54E-01
1.57E-01
1.55E-01
1.55E-01
1.57E-01
1.57E-01
1.55E-01
1.59E-01
1.57E-01
1.57E-01
1.59E-01
1.55E-01
1.61E-01
1.57E-01
1.60E-01
1.60E-01
1.59E-01
1.63E-01
1.62E-01
1.59E-01
1.62E-01
1.59E-01
1.62E-01
1.65E-01
1.60E-01
1.64E-01
1.63E-01
1.63E-01
1.62E-01
1.63E-01
1.65E-01
1.63E-01
1.66E-01
1.67E-01
1.67E-01
1.65E-01
1.68E-01
1.66E-01
1.66E-01
1.69E-01
1.66E-01
1.68E-01
1.69E-01
1.69E-01
1.66E-01
1.70E-01
1.68E-01
1.69E-01
1.71E-01
1.72E-01
1.70E-01
1.70E-01
1.72E-01
1.72E-01
1.73E-01
1.70E-01
1.76E-01
1.74E-01
1.76E-01
1.75E-01
1.74E-01
1.74E-01
1.78E-01
1.75E-01
1.77E-01
1.78E-01
1.78E-01
1.82E-01
1.80E-01
1.81E-01
1.82E-01
1.81E-01
1.86E-01
1.82E-01
1.85E-01
1.83E-01
1.83E-01
1.86E-01
1.91E-01
1.91E-01
1.87E-01
1.90E-01
1.92E-01
1.93E-01
1.95E-01
1.93E-01
1.95E-01
1.96E-01
1.97E-01
1.98E-01
1.99E-01
2.00E-01
2.01E-01
2.01E-01
2.05E-01
2.02E-01
2.05E-01
2.04E-01
2.06E-01
2.07E-01
2.10E-01
2.09E-01
2.11E-01
2.12E-01
2.14E-01
2.09E-01
2.13E-01
2.15E-01
2.16E-01
2.15E-01
2.17E-01
2.17E-01
2.16E-01
2.16E-01
2.18E-01
2.19E-01
2.18E-01
2.22E-01
2.21E-01
2.22E-01
2.24E-01
2.25E-01
2.27E-01
2.26E-01
2.25E-01
2.27E-01
2.29E-01
2.27E-01
2.27E-01
2.33E-01
2.31E-01
2.35E-01
2.33E-01
2.37E-01
2.44E-01
2.44E-01
2.47E-01
2.49E-01
2.54E-01
2.58E-01
2.60E-01
2.69E-01
2.70E-01
2.74E-01
2.78E-01
2.82E-01
2.88E-01
2.90E-01
2.98E-01
3.00E-01
3.08E-01
3.16E-01
3.21E-01
3.30E-01
3.31E-01
3.43E-01
3.43E-01
3.53E-01
3.55E-01
3.65E-01
3.67E-01
3.72E-01
3.81E-01
3.88E-01
3.98E-01
4.10E-01
4.20E-01
4.28E-01
4.39E-01
4.50E-01
4.58E-01
4.70E-01
4.77E-01
4.88E-01
4.99E-01
5.07E-01
5.20E-01
5.27E-01
5.38E-01
5.52E-01
5.60E-01
5.71E-01
5.88E-01
6.09E-01
6.32E-01
6.57E-01
6.80E-01
7.05E-01
7.33E-01
7.60E-01
7.88E-01
8.16E-01
8.43E-01
8.73E-01
9.06E-01
9.38E-01
9.68E-01
1.00E+00
1.04E+00
1.07E+00
1.11E+00
1.16E+00
1.19E+00
1.24E+00
1.29E+00
1.33E+00
1.38E+00
1.43E+00
1.48E+00
1.53E+00
1.59E+00
1.65E+00
1.70E+00
1.76E+00
1.83E+00
1.89E+00
1.96E+00
2.03E+00
2.11E+00
2.19E+00
2.28E+00
2.36E+00
2.44E+00
2.54E+00
2.63E+00
2.72E+00
2.81E+00
2.92E+00
3.02E+00
3.13E+00
3.24E+00
3.36E+00
3.49E+00
3.62E+00
3.76E+00
3.90E+00
4.05E+00
4.20E+00
4.35E+00
4.51E+00
4.67E+00
4.83E+00
5.00E+00
5.18E+00
5.36E+00
5.56E+00
5.76E+00
5.98E+00
6.20E+00
6.44E+00
6.69E+00
7.19E+00
7.50E+00
7.82E+00
8.13E+00
8.42E+00
8.72E+00
9.02E+00
9.34E+00
9.67E+00
1.00E+01
1.04E+01
1.07E+01
1.11E+01
1.14E+01
1.17E+01
1.19E+01
1.21E+01
1.22E+01
1.23E+01
1.22E+01
1.20E+01
1.18E+01
1.14E+01
1.09E+01
1.04E+01
9.74E+00
9.04E+00
8.29E+00
7.52E+00
6.75E+00
6.00E+00
5.29E+00
4.64E+00
4.05E+00
3.52E+00
3.04E+00
2.62E+00
2.24E+00
1.90E+00
1.58E+00
1.29E+00
1.03E+00
7.75E-01
5.46E-01
3.33E-01
1.41E-01
-3.74E-02
-1.91E-01
-3.30E-01
-4.59E-01
-5.81E-01
-7.05E-01
-8.22E-01
-9.49E-01
-1.08E+00
-1.22E+00
-1.38E+00
-1.55E+00
-1.71E+00
-1.90E+00
-2.07E+00
-2.25E+00
-2.42E+00
-2.58E+00
-2.73E+00
-2.87E+00
-3.01E+00
-3.15E+00
-3.27E+00
-3.40E+00
-3.53E+00
-3.66E+00
-3.79E+00
-3.93E+00
-4.08E+00
-4.22E+00
-4.37E+00
-4.52E+00
-4.67E+00
-4.82E+00
-4.97E+00
-5.12E+00
-5.26E+00
-5.40E+00
-5.53E+00
-5.66E+00
-5.78E+00
-5.90E+00
-6.02E+00
-6.13E+00
-6.23E+00
-6.33E+00
-6.42E+00
-6.51E+00
-6.59E+00
-6.67E+00
-6.73E+00
-6.80E+00
-6.85E+00
-6.91E+00
-6.96E+00
-7.00E+00
-7.04E+00
-7.07E+00
-7.11E+00
-7.14E+00
-7.16E+00
-7.19E+00
-7.21E+00
-7.23E+00
-7.25E+00
-7.27E+00
-7.28E+00
-7.29E+00
-7.30E+00
-7.32E+00
-7.33E+00
-7.34E+00
-7.35E+00
-7.36E+00
-7.37E+00
-7.38E+00
-7.39E+00
-7.40E+00
-7.41E+00
-7.42E+00
-7.44E+00
-7.45E+00
-7.46E+00
-7.48E+00
-7.50E+00
-7.52E+00
-7.53E+00
-7.55E+00
-7.57E+00
-7.59E+00
-7.60E+00
-7.61E+00
-7.63E+00
-7.64E+00
-7.65E+00
-7.66E+00
-7.68E+00
-7.70E+00
-7.71E+00
-7.72E+00
-7.74E+00
-7.76E+00
-7.77E+00
-7.81E+00
-7.85E+00
-7.89E+00
-7.94E+00
-7.98E+00
-8.02E+00
-8.07E+00
-8.10E+00
-8.15E+00
-8.18E+00
-8.21E+00
-8.24E+00
-8.26E+00
-8.28E+00
-8.29E+00
-8.30E+00
-8.30E+00
-8.28E+00
-8.26E+00
-8.23E+00
-8.17E+00
-8.12E+00
-8.03E+00
-7.95E+00
-7.84E+00
-7.72E+00
-7.57E+00
-7.42E+00
-7.25E+00
-7.07E+00
-6.87E+00
-6.66E+00
-6.45E+00
-6.22E+00
-5.98E+00
-5.74E+00
-5.49E+00
-5.25E+00
-5.00E+00
-4.76E+00
-4.52E+00
-4.29E+00
-4.06E+00
-3.84E+00
-3.63E+00
-3.42E+00
-3.23E+00
-3.04E+00
-2.86E+00
-2.69E+00
-2.53E+00
-2.37E+00
-2.23E+00
-2.10E+00
-1.97E+00
-1.85E+00
-1.73E+00
-1.63E+00
-1.52E+00
-1.43E+00
-1.34E+00
-1.26E+00
-1.17E+00
-1.10E+00
-1.02E+00
-9.56E-01
-8.89E-01
-8.29E-01
-7.70E-01
-7.15E-01
-6.64E-01
-6.10E-01
-5.62E-01
-5.17E-01
-4.75E-01
-4.33E-01
-3.95E-01
-3.60E-01
-3.23E-01
-2.90E-01
-2.58E-01
-2.28E-01
-2.02E-01
-1.76E-01
-1.54E-01
-1.27E-01
-1.01E-01
-8.57E-02
-6.37E-02
-4.41E-02
-2.84E-02
-1.07E-02
7.62E-03
2.21E-02
3.55E-02
5.08E-02
6.37E-02
7.40E-02
8.53E-02
9.73E-02
1.06E-01
1.20E-01
1.26E-01
1.35E-01
1.43E-01
1.48E-01
1.57E-01
1.65E-01
1.70E-01
1.74E-01
1.80E-01
1.86E-01
1.88E-01
1.91E-01
1.95E-01
2.01E-01
2.02E-01
2.05E-01
2.07E-01
2.09E-01
2.11E-01
2.14E-01
2.19E-01
2.15E-01
2.23E-01
2.21E-01
2.24E-01
2.27E-01
2.28E-01
2.30E-01
2.28E-01
2.31E-01
2.32E-01
2.33E-01
2.35E-01
2.39E-01
2.40E-01
2.39E-01
2.39E-01
2.41E-01
2.44E-01
2.42E-01
2.45E-01
2.46E-01
2.44E-01
2.48E-01
2.49E-01
2.50E-01
2.50E-01
2.50E-01
2.54E-01
2.52E-01
2.51E-01
2.55E-01
2.55E-01
2.58E-01
2.55E-01
2.60E-01
2.61E-01
2.63E-01
2.58E-01
2.61E-01
2.61E-01
2.64E-01
2.63E-01
2.66E-01
2.65E-01
2.67E-01
2.68E-01
2.69E-01
2.69E-01
2.72E-01
2.71E-01
2.75E-01
2.71E-01
2.73E-01
2.76E-01
2.76E-01
2.79E-01
2.81E-01
2.86E-01
2.85E-01
2.89E-01
2.88E-01
2.87E-01
2.92E-01
2.92E-01
2.94E-01
2.95E-01
2.97E-01
3.02E-01
3.01E-01
3.02E-01
3.02E-01
3.06E-01
3.05E-01
3.09E-01
3.12E-01
3.12E-01
3.17E-01
3.17E-01
3.18E-01
3.20E-01
3.24E-01
3.25E-01
3.28E-01
3.29E-01
3.34E-01
3.38E-01
3.44E-01
3.47E-01
3.53E-01
3.53E-01
3.59E-01
3.62E-01
3.65E-01
3.73E-01
3.72E-01
3.77E-01
3.78E-01
3.82E-01
3.84E-01
3.84E-01
3.84E-01
3.84E-01
3.84E-01
3.87E-01

 ]  ;


time1=[0
0.000133234
0.000266468
0.000532937
0.00106587
0.00213175
0.00426349
0.00852699
0.017054
0.0341079
0.0682159
0.136432
0.272864
0.545727
1.09145
2.18291
4.36582
8.73164
17.4633
34.9265
69.8531
139.706
279.412
500
500
500
500.001
500.001
500.003
500.004
500.007
500.01
500.015
500.021
500.026
500.037
500.049
500.071
500.093
500.115
500.137
500.16
500.204
500.248
500.293
500.337
500.426
500.515
500.604
500.693
500.781
500.87
501.048
501.226
501.403
501.759
502.114
502.469
502.825
503.535
504.246
504.957
505.667
506.378
507.089
507.799
508.51
509.221
510.642
512.063
513.485
514.906
516.327
517.749
519.17
520.591
522.013
523.434
524.855
526.134
527.286
528.313
529.174
529.691
530.209
530.634
530.991
531.305
531.579
531.826
532.048
532.247
532.447
532.647
532.847
533.047
533.446
533.846
534.645
535.444
536.243
537.042
537.841
538.64
539.44
540.239
541.038
541.837
542.636
543.435
544.234
545.033
545.832
546.632
547.351
548.07
548.717
549.365
549.947
550.471
550.943
551.368
551.75
552.132
552.476
552.82
553.164
553.508
553.852
554.196
554.54
554.884
555.228
555.572
555.916
556.26
556.604
556.948
557.292
557.636
557.98
558.324
558.668
559.012
559.356
559.7
560.044
560.354
560.664
560.942
561.221
561.5
561.778
562.057
562.335
562.614
562.893
563.143
563.394
563.645
563.896
564.147
564.397
564.648
564.899
565.15
565.4
565.651
565.902
566.128
566.353
566.579
566.805
567.03
567.256
567.482
567.708
567.933
568.159
568.362
568.565
568.768
568.971
569.175
569.378
569.581
569.784
569.987
570.19
570.393
570.596
570.8
571.003
571.206
571.409
571.592
571.775
571.939
572.104
572.268
572.433
572.597
572.762
572.926
573.091
573.255
573.42
573.584
573.749
573.914
574.078
574.243
574.407
574.572
574.736
574.901
575.065
575.23
575.394
575.559
575.723
575.888
576.052
576.201
576.349
576.482
576.615
576.735
576.855
576.975
577.095
577.215
577.335
577.455
577.575
577.695
577.815
577.935
578.054
578.174
578.294
578.414
578.534
578.654
578.774
578.882
578.99
579.087
579.184
579.271
579.358
579.436
579.512
579.58
579.648
579.709
579.77
579.825
579.88
579.93
579.979
580.021
580.059
580.092
580.122
580.149
580.174
580.195
580.215
580.233
580.249
580.263
580.276
580.287
580.299
580.309
580.319
580.327
580.336
580.343
580.35
580.357
580.363
580.369
580.375
580.38
580.385
580.389
580.394
580.398
580.402
580.405
580.409
580.412
580.415
580.418
580.421
580.423
580.426
580.428
580.43
580.432
580.434
580.439
580.443
580.447
580.452
580.456
580.46
580.464
580.469
580.473
580.476
580.479
580.482
580.485
580.487
580.489
580.491
580.492
580.494
580.495
580.497
580.498
580.5
580.502
580.503
580.505
580.506
580.508
580.51
580.511
580.513
580.514
580.516
580.518
580.519
580.522
580.525
580.529
580.532
580.535
580.538
580.541
580.544
580.548
580.551
580.554
580.557
580.56
580.563
580.567
580.57
580.573
580.576
580.579
580.586
580.592
580.598
580.605
580.611
580.617
580.624
580.63
580.636
580.643
580.649
580.655
580.662
580.668
580.674
580.681
580.687
580.693
580.7
580.706
580.713
580.719
580.725
580.732
580.738
580.744
580.751
580.757
580.763
580.77
580.776
580.782
580.789
580.795
580.801
580.808
580.814
580.82
580.827
580.833
580.839
580.846
580.852
580.858
580.865
580.871
580.877
580.884
580.89
580.896
580.903
580.909
580.915
580.922
580.928
580.935
580.941
580.947
580.954
580.96
580.966
580.973
580.979
580.985
580.992
580.998
581.004
581.011
581.017
581.03
581.037
581.045
581.052
581.059
581.066
581.073
581.08
581.086
581.093
581.1
581.107
581.114
581.12
581.127
581.134
581.141
581.148
581.154
581.161
581.168
581.175
581.182
581.188
581.195
581.202
581.209
581.216
581.222
581.229
581.236
581.243
581.25
581.256
581.263
581.27
581.277
581.284
581.291
581.297
581.304
581.311
581.318
581.325
581.331
581.338
581.345
581.352
581.359
581.365
581.372
581.379
581.386
581.393
581.399
581.406
581.413
581.42
581.427
581.433
581.44
581.447
581.454
581.461
581.467
581.474
581.481
581.488
581.495
581.501
581.508
581.515
581.522
581.529
581.535
581.542
581.549
581.556
581.563
581.57
581.576
581.583
581.59
581.597
581.604
581.61
581.617
581.624
581.631
581.638
581.644
581.651
581.658
581.665
581.672
581.678
581.685
581.692
581.699
581.706
581.712
581.719
581.726
581.733
581.74
581.746
581.753
581.76
581.767
581.774
581.78
581.787
581.794
581.801
581.808
581.815
581.821
581.828
581.835
581.842
581.849
581.855
581.861
581.868
581.874
581.88
581.886
581.892
581.898
581.904
581.91
581.917
581.923
581.929
581.935
581.941
581.947
581.952
581.956
581.961
581.966
581.971
581.976
581.981
581.986
581.991
581.996
582.001
582.006
582.016
582.026
582.036
582.046
582.056
582.066
582.076
582.086
582.095
582.105
582.115
582.125
582.135
582.145
582.155
582.165
582.175
582.185
582.195
582.205
582.214
582.224
582.234
582.244
582.254
582.264
582.274
582.284
582.294
582.304
582.314
582.324
582.333
582.343
582.353
582.363
582.373
582.383
582.393
582.403
582.413
582.423
582.433
582.443
582.453
582.463
582.472
582.482
582.492
582.502
582.512
582.522
582.532
582.542
582.552
582.562
582.572
582.582
582.591
582.601
582.611
582.621
582.631
582.641
582.651
582.661
582.671
582.681
582.691
582.701
582.711
582.72
582.73
582.74
582.75
582.76
582.77
582.78
582.79
582.8
582.81
582.82
582.83
582.84
582.849
582.859
582.869
582.879
582.889
582.899
582.909
582.919
582.929
582.939
582.949
582.959
582.969
582.978
582.988
582.998
583.008
583.018
583.028
583.038
583.048
583.058
583.068
583.078
583.088
583.097
583.107
583.117
583.127
583.137
583.147
583.157
583.167
583.177
583.187
583.197
583.207
583.217
583.227
583.236
583.246
583.256
583.266
583.276
583.286
583.296
583.306
583.316
583.326
583.336
583.346
583.355
583.365
583.375
583.385
583.395
583.405
583.415
583.425
583.435
583.445
583.455
583.465
583.474
583.484
583.494
583.504
583.514
583.524
583.534
583.554
583.574
583.594
583.613
583.633
583.653
583.673
583.693
583.713
583.732
583.752
583.772
583.792
583.812
583.832
583.852
583.871
583.891
583.911
583.931
583.951
583.971
584.01
584.05
584.09
584.125
584.157
584.186
584.214
584.24
584.266
584.292
584.317
584.343
584.369
584.395
584.42
584.446
584.472
584.497
584.523
584.549
584.575
584.6
584.626
584.652
584.678
584.703
584.729
584.755
584.781
584.806
584.858
584.909
584.961
585.012
585.064
585.115
585.167
585.218
585.27
585.321
585.372
585.424
585.475
585.527
585.573
585.615
585.652
585.686
585.72
585.754
585.787
] ;




n=1 ;
for i=length(Axial):-1:1
Axiall1(n,1)=Axial(i,1);
n=n+1 ;
end

%
Axial_current(1:801,1)=Axiall1 ;

% 
SA1 = Axial_current'*v1/norm(Axial_current);
SA2 = Axial_current'*v2/norm(Axial_current);

%figure
plot(SA1,SA2,'*r','LineWidth',2)



%%
% figure
% plot(time1, Axiall1, 'LineWidth',1)
% xlabel('time')
% ylabel('Axial Current')
% title('Axial Current')