changeset 12700:2ebf4955381e octave-forge

fix bug in NAN/trimmean when DIM>1, credit for this bug fix goes to Bjørn Lillekjendlie <b-lillek@online.no>
author schloegl
date Wed, 16 Dec 2015 08:58:57 +0000
parents 41d5b212e9fa
children 794b03395bbd
files extra/NaN/inst/trimmean.m
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/extra/NaN/inst/trimmean.m	Sun Dec 06 10:19:16 2015 +0000
+++ b/extra/NaN/inst/trimmean.m	Wed Dec 16 08:58:57 2015 +0000
@@ -15,8 +15,7 @@
 % [1] http://www.fifi.org/doc/gnumeric-doc/html/C/gnumeric-trimmean.html
 
 
-%	$Id$
-%	Copyright (C) 2009,2010,2011 by Alois Schloegl <alois.schloegl@gmail.com>	
+%	Copyright (C) 2009,2010,2011 by Alois Schloegl <alois.schloegl@ist.ac.at>
 %       This function is part of the NaN-toolbox
 %       http://pub.ist.ac.at/~schloegl/matlab/NaN/
 
@@ -64,7 +63,7 @@
 			for m=1:D2,
 				n  = floor(N*p(m)/2);
 			        f  = sum(t(1+n:N-n))/(N-2*n);
-				Q(xo + m*D1) = f;
+				Q(xo + 1 + (m-1)*D1) = f;
 			end; 
 		end;
 	end;