From ca2ba044b403d73d6a815c2356034ba83051fde6 Mon Sep 17 00:00:00 2001 From: "Frederik J. Simons" Date: Thu, 20 Aug 2020 13:26:46 -0400 Subject: [PATCH] Backus-Robin asymptotic approximation of Legendre polynomials --- backus.m | 2 +- bindens.m | 53 -------------------------------------------- row2stats.m | 64 ----------------------------------------------------- 3 files changed, 1 insertion(+), 118 deletions(-) delete mode 100644 bindens.m delete mode 100644 row2stats.m diff --git a/backus.m b/backus.m index 1a2552d..5ff80ab 100644 --- a/backus.m +++ b/backus.m @@ -28,7 +28,7 @@ % % See also DAHLEN, HILBXLM. % -% Last modified by fjsimons-at-alum.mit.edu, 03/16/2016 +% Last modified by fjsimons-at-alum.mit.edu, 03/17/2016 defval('norma','sch') defval('N',1000); diff --git a/bindens.m b/bindens.m deleted file mode 100644 index 81f18e2..0000000 --- a/bindens.m +++ /dev/null @@ -1,53 +0,0 @@ -function [h,c11,cmn,hh,ybine]=bindens(x,y,nxbins,nybins) -% [h,c11,cmn,hh,ybine]=BINDENS(x,y,nxbins,nybins) -% -% Density plot for data in 2D histograms -% -% INPUT: -% -% x,y The data vectors -% nxbins, nybins The number of bins in the x and y direction -% -% OUTPUT: -% -% h The '2D' histogram -% c11,cmn The centers of the top left and bottom right of this histogram -% hh Globally normalized histogram -% ybine The y bin edges that are being used -% -% See also ROW2STATS, HIST2D -% -% Last modified by fjsimons-at-alum.mit.edu, 03/18/2013 - -defval('nxbins',10) -defval('nybins',10) -defval('xbin',range(x)/nxbins); -defval('ybin',range(y)/nybins); - -% Specify the y-bin edges, that's one more than there are bins -ybine=linspace(min(y),max(y),nybins+1); - -% Sort the data in the first column -[x,I]=sort(x,1); - -% And have the second column follow -y=y(I); - -% Bin the x-data -ix=ceil((x-min(x))/xbin); -ix=ix+(ix==0); - -% Also must put in nans for the bins that didn't happen -adix=skip(1:max(ix),unique(ix)); -ix=[ix ; adix(:)]; -y=[y ; nan(size(adix(:)))]; - -% Now use ROW2STATS to get the y-histograms -[g,s,h,hh]=row2stats(ix,y,ybine); - -% Do not do flipud as the histogram treats the bins as one-sided to the -% right but rather find the pixel-centered coordinates of the histogram? -c11(1)=min(x)+xbin/2; -cmn(1)=max(x)-xbin/2; -c11(2)=min(y)+ybin/2; -cmn(2)=max(y)-ybin/2; diff --git a/row2stats.m b/row2stats.m deleted file mode 100644 index 8864182..0000000 --- a/row2stats.m +++ /dev/null @@ -1,64 +0,0 @@ -function [g,s,h,hh]=row2stats(col1,col2,ybine) -% [g,s,h,hh]=ROW2STATS(col1,col2,ybine) -% -% Find statistics of data presented belonging to different groups -% -% INPUT: -% -% col1 The first column of data of which groups are made -% col2 The second column of data -% ybine The bin edges to make histograms of the second data column -% -% OUTPUT: -% -% g The different groups identified in the first data column -% s Structure array with mean, median, etc of data per group -% h Matrix with histogram counts per group in the bins provided -% hh Matrix with histogram counts globally normalized -% -% See also BINDENS -% -% Last modified by fjsimons-at-alum.mit.edu, 12/21/2011 - -defval('nybins',10) -defval('ybin',range(col2)/nybins); -defval('ybine',linspace(min(col2),max(col2),nybins+1)); - -% Sort the data in the first column -[col1,I]=sort(col1,1); -% And have the second column follow -col2=col2(I); -% The beginning index of every new value in column 1 -beg=[1 find(diff([col1(1) col1(:)']))]; -% The ending index of every separate magnitude -ent=[beg(2:end)-1 length(col1)]; - -% Now collect statistics of the values in column 2 -for index=1:length(beg) - coli=beg(index):ent(index); - % Identify the category in the first column - g(index)=col1(beg(index)); - % Identify the element of the second column - colrel=col2(coli); - % Construct the statistics of the second column - s.mean(index)=nanmean(colrel); - s.median(index)=nanmedian(colrel); - s.nonnans(index)=sum(~isnan(colrel)); - s.variance(index)=nanvar(colrel); - s.p25(index)=prctile(colrel,25); - s.p75(index)=prctile(colrel,75); - if nargout>2 - h(:,index)=histc(colrel,ybine); - hh(:,index)=h(:,index); - h(:,index)=h(:,index)/sum(h(:,index)); - end -end - -if nargout>2 - % Now remember the oddity about the HISTC bins - h(end-1,:)=h(end-1,:)+h(end,:); - h=h(1:end-1,:); - hh(end-1,:)=hh(end-1,:)+hh(end,:); - hh=hh(1:end-1,:); -end -