Mercurial > octave-nkf
diff scripts/statistics/base/median.m @ 7411:83a8781b529d
[project @ 2008-01-22 21:52:25 by jwe]
author | jwe |
---|---|
date | Tue, 22 Jan 2008 21:52:26 +0000 |
parents | a1dbe9d80eee |
children | 81d6ab3ac93c |
line wrap: on
line diff
--- a/scripts/statistics/base/median.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/median.m Tue Jan 22 21:52:26 2008 +0000 @@ -94,3 +94,19 @@ endif endfunction + +%!test +%! x = [1, 2, 3, 4, 5, 6]; +%! x2 = x'; +%! y = [1, 2, 3, 4, 5, 6, 7]; +%! y2 = y'; +%! +%! assert((median (x) == median (x2) && median (x) == 3.5 +%! && median (y) == median (y2) && median (y) == 4 +%! && median ([x2, 2*x2]) == [3.5, 7] +%! && median ([y2, 3*y2]) == [4, 12])); + +%!error median (); + +%!error median (1, 2, 3); +