view slowmedcouple.m @ 18:6339e1a06aa9

slowmedcouple: sort in reverse
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Sat, 17 Jan 2015 19:53:06 -0500
parents 3958c6e77442
children d9230d702fbf
line wrap: on
line source

z = load("gamma2");
n = length(z);
n2 = ceil(n/2);
z = sort(z, "descend");
zmed = median(z);
z -= zmed;
zplus = z(z >= 0);
zminus = z(z <= 0)';
zz = (zplus + zminus)./(zplus - zminus);
zz(isnan(zz)) = 0;
zzsort = sort(zz(:), "descend");
medc_idx = ceil(n2^2/2);
mc = zzsort(medc_idx);
printf("%.16g\n", mc);