From 0e8e30738de8e4fc09145d41b2c8faf3a2d481a5 Mon Sep 17 00:00:00 2001 From: mlxd Date: Fri, 16 Dec 2016 16:49:11 +0900 Subject: [PATCH] Analysis files add --- matlab/psi6.m | 14 ++++++++++++-- matlab/voronoi_cells.m | 36 ------------------------------------ 2 files changed, 12 insertions(+), 38 deletions(-) delete mode 100644 matlab/voronoi_cells.m diff --git a/matlab/psi6.m b/matlab/psi6.m index 049b8a2e..683001b8 100644 --- a/matlab/psi6.m +++ b/matlab/psi6.m @@ -1,10 +1,20 @@ function [psi6_pos,nn] = psi6(pos,X,Y,radius) - [nn,idx] = findNN(pos,X,Y,radius); +%Calculate the orientational order parameter defined at point pos +%between the points (X,Y) +% pos: Defines the location to calculate the orientational order +% X,Y: Vector of entire X,Y range of points +% radius: Radius over which to determine neighbouring points +%Returns +% psi6_pos: The value of orientational order psi_6 at position pos +% nn: Number of nearest neighbours + + [nn,idx] = findNN(pos,X,Y,radius); %find number of neighbours and indices of + %neighbours for X,Y psi6_pos = 0; if size(nn,1) > 0 for ii=1:size(nn,1) - psi6_pos = psi6_pos + exp(6*1i*getAngle2(pos, [X(idx(ii)), Y(idx(ii))] )); + psi6_pos = psi6_pos + exp(6*1i*getAngle(pos, [X(idx(ii)), Y(idx(ii))] )); end psi6_pos = psi6_pos./length(nn); end diff --git a/matlab/voronoi_cells.m b/matlab/voronoi_cells.m deleted file mode 100644 index 495a9a0f..00000000 --- a/matlab/voronoi_cells.m +++ /dev/null @@ -1,36 +0,0 @@ -function [area,avg_area,num_edges,var]=voronoi_cells(x,y,q,dx) -[v,c]=voronoin([x y]); -area=zeros(length(c),1); -num_edges=zeros(length(c),1); -avg_area = 0; -clf; -for jj = 1:length(c) - if (all(c{jj}~=1) && all(sqrt((x(jj)).^2 + (y(jj)).^2)<230*dx)); % If at least one of the indices is 1, - % then it is an open region and we can't - % patch that. - area(jj)=polyarea(v(c{jj},1),v(c{jj},2)); - avg_area = avg_area + area(jj); - h = patch(v(c{jj},1),v(c{jj},2),area(jj)); % use area as color - if q(jj)< 0 - h.EdgeColor = 'red'; - h.LineWidth = '2'; - elseif q(jj) == 0 - h.EdgeColor = 'black'; - h.LineStyle = '-' - else - h.EdgeColor = 'white'; - h.LineStyle = '-' - end - num_edges(jj) = length(c{jj}); - get(h); - end -end -%axis square;axis([200 800 200 800]*dx);caxis([740 860]*dx*dx);;colorbar; -hold on; plot(x,y,'r*');plot(x,y,'bo'); -set(gca,'FontName','Latin Modern Roman','FontSize',22); -set(gca,'TickLabelInterpreter', 'latex');axis off; -drawnow; - -avg_area=avg_area./nnz(area); -var = sum((area(area>1) - avg_area).^2); -var = var./nnz(area); \ No newline at end of file