This repository has been archived on 2021-05-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
scientificComputing/statistics/code/checkmymedian.m

13 lines
427 B
Matlab

% check whether the median returned by mymedian
% really separates a vector into two halfs
for i = 1:140 % loop over different length
for k = 1:10 % try several times
a = randn(i, 1); % generate some data
m = mymedian(a); % compute median
if length(a(a>m)) ~= length(a(a<m)) % check
disp('error!')
end
end
end