-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Thanks for the code.
- I found out circ_median handle one situation wrong. say, beta=[1 2 2 4 4 6], according to the code of circ_median below, dm = [5 2 2 2 2 5], m = 2, idx = [2 3], md = 2. But md should be the mean of 2 and 4, i.e., 3. Therefore, it seems circ-median handle this case wrong.
dd = circ_dist2(beta,beta);
m1 = sum(dd>=0,1);
m2 = sum(dd<=0,1);
dm = abs(m1-m2);
if mod(n,2)==1
[m, idx] = min(dm);
else
m = min(dm);
idx = find(dm==m,2);
end
if m > 1
warning('CIRCSTAT:circ_median:tiesDetected', ...
'Ties detected.') %#ok<WNTAG>
end
md = circ_mean(beta(idx));To correct it, I suggest change the last part into,
else
m = min(dm);
idx = find(dm==m);%
end
if m>1 && length(unique(beta(idx)))~=2
warning('')% same as above
md = circ_mean(beta(idx))- In the original circ_median, assuming beta = 0:pi/3:2pi, then each phase should be the median. However, from
m = min(dm); idx = find(dm==m,2), it seems it only includes the first two phases, rather than take them all. I simply suggest change it intoidx = find(dm==m).
Metadata
Metadata
Assignees
Labels
No labels