-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/mrkrause/circstat-matlab
- Loading branch information
Showing
38 changed files
with
134 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,4 +60,3 @@ | |
% | ||
% Author: | ||
% Philipp Berens & Marc J. Velasco, 2009 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
% By Philipp Berens, 2009 | ||
% [email protected] - www.kyb.mpg.de/~berens/circStat.html | ||
|
||
alpha = alpha * pi /180; | ||
alpha = alpha * pi /180; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ | |
end | ||
|
||
alpha = mod(alpha*p,2*pi); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
% [d spacing of bin centers for binned data, if supplied | ||
% correction factor is used to correct for bias in | ||
% estimation of r, in radians (!)] | ||
% [dim compute along this dimension, default is 1] | ||
% [dim compute along this dimension, default: 1st non-singular dimension] | ||
% | ||
% Output: | ||
% t mean +- d yields upper/lower (1-xi)% confidence limit | ||
|
@@ -28,7 +28,10 @@ | |
% [email protected] - www.kyb.mpg.de/~berens/circStat.html | ||
|
||
if nargin < 5 | ||
dim = 1; | ||
dim = find(size(alpha) > 1, 1, 'first'); | ||
if isempty(dim) | ||
dim = 1; | ||
end | ||
end | ||
|
||
if nargin < 4 || isempty(d) | ||
|
@@ -74,7 +77,4 @@ | |
|
||
% apply final transform | ||
t = acos(t./R); | ||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,4 @@ | |
kappa = (N-1)^3*kappa/(N^3+N); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,10 +51,4 @@ | |
f = 1/f; | ||
pval = 2*(1-fcdf(f, n2, n1)); | ||
end | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
function [k k0] = circ_kurtosis(alpha, w, dim) | ||
function [k, k0] = circ_kurtosis(alpha, w, dim) | ||
|
||
% [k k0] = circ_kurtosis(alpha,w,dim) | ||
% Calculates a measure of angular kurtosis. | ||
% | ||
% Input: | ||
% alpha sample of angles | ||
% [w weightings in case of binned angle data] | ||
% [dim statistic computed along this dimension, 1] | ||
% [dim statistic computed along this dimension, default: 1st non-singular dimension] | ||
% | ||
% If dim argument is specified, all other optional arguments can be | ||
% left empty: circ_kurtosis(alpha, [], dim) | ||
|
@@ -25,7 +25,10 @@ | |
% [email protected] | ||
|
||
if nargin < 3 | ||
dim = 1; | ||
dim = find(size(alpha) > 1, 1, 'first'); | ||
if isempty(dim) | ||
dim = 1; | ||
end | ||
end | ||
|
||
if nargin < 2 || isempty(w) | ||
|
@@ -48,4 +51,5 @@ | |
theta2 = repmat(theta, size(alpha)./size(theta)); | ||
k = sum(w.*(cos(2*(circ_dist(alpha,theta2)))),dim)./sum(w,dim); | ||
k0 = (rho2.*cos(circ_dist(mu2,2*theta))-R.^4)./(1-R).^2; % (formula 2.30) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
function [mu ul ll] = circ_mean(alpha, w, dim) | ||
function [mu, ul, ll] = circ_mean(alpha, w, dim) | ||
% | ||
% [mu ul ll] = circ_mean(alpha, w, dim) | ||
% Computes the mean direction for circular data. | ||
% | ||
% Input: | ||
% alpha sample of angles in radians | ||
% [w weightings in case of binned angle data] | ||
% [dim compute along this dimension, default is 1] | ||
% [dim compute along this dimension, default: 1st non-singular dimension] | ||
% | ||
% If dim argument is specified, all other optional arguments can be | ||
% left empty: circ_mean(alpha, [], dim) | ||
|
@@ -29,7 +29,10 @@ | |
% [email protected] - www.kyb.mpg.de/~berens/circStat.html | ||
|
||
if nargin < 3 | ||
dim = 1; | ||
dim = find(size(alpha) > 1, 1, 'first'); | ||
if isempty(dim) | ||
dim = 1; | ||
end | ||
end | ||
|
||
if nargin < 2 || isempty(w) | ||
|
@@ -53,4 +56,5 @@ | |
t = circ_confmean(alpha,0.05,w,[],dim); | ||
ul = mu + t; | ||
ll = mu - t; | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
% | ||
% Input: | ||
% alpha sample of angles in radians | ||
% [dim compute along this dimension, default is 1, must | ||
% [dim compute along this dimension, default: 1st non-singular dimension, must | ||
% be either 1 or 2 for circ_median] | ||
% | ||
% Output: | ||
|
@@ -25,7 +25,10 @@ | |
% [email protected] - www.kyb.mpg.de/~berens/circStat.html | ||
|
||
if nargin < 2 | ||
dim = 1; | ||
dim = find(size(alpha) > 1, 1, 'first'); | ||
if isempty(dim) | ||
dim = 1; | ||
end | ||
end | ||
|
||
M = size(alpha); | ||
|
@@ -48,7 +51,7 @@ | |
|
||
dm = abs(m1-m2); | ||
if mod(n,2)==1 | ||
[m idx] = min(dm); | ||
[m, idx] = min(dm); | ||
else | ||
m = min(dm); | ||
idx = find(dm==m,2); | ||
|
@@ -70,4 +73,5 @@ | |
|
||
if dim == 2 | ||
med = med'; | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,4 @@ | |
|
||
% compute p-value with binomial test | ||
pval = sum(binopdf([0:min(n1,n2) max(n1,n2):n],n,0.5)); | ||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
function [mp rho_p mu_p] = circ_moment(alpha, w, p, cent, dim) | ||
function [mp, rho_p, mu_p] = circ_moment(alpha, w, p, cent, dim) | ||
|
||
% [mp rho_p mu_p] = circ_moment(alpha, w, p, cent, dim) | ||
% Calculates the complex p-th centred or non-centred moment | ||
|
@@ -9,7 +9,7 @@ | |
% [w weightings in case of binned angle data] | ||
% [p p-th moment to be computed, default is p=1] | ||
% [cent if true, central moments are computed, default = false] | ||
% [dim compute along this dimension, default is 1] | ||
% [dim compute along this dimension, default is 1st non-singular dimension] | ||
% | ||
% If dim argument is specified, all other optional arguments can be | ||
% left empty: circ_moment(alpha, [], [], [], dim) | ||
|
@@ -29,7 +29,10 @@ | |
% [email protected] | ||
|
||
if nargin < 5 | ||
dim = 1; | ||
dim = find(size(alpha) > 1, 1, 'first'); | ||
if isempty(dim) | ||
dim = 1; | ||
end | ||
end | ||
|
||
if nargin < 4 | ||
|
@@ -65,5 +68,4 @@ | |
|
||
rho_p = abs(mp); | ||
mu_p = angle(mp); | ||
|
||
|
||
end |
Oops, something went wrong.