1 ## Copyright (C) 2008 Bill Denney <bill@denney.ws>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} {@var{llv} =} llow (@var{data})
18 ## @deftypefnx {Function File} {@var{llv} =} llow (@var{data}, @var{nperiods})
19 ## @deftypefnx {Function File} {@var{llv} =} llow (@var{data}, @var{nperiods}, @var{dim})
21 ## Compute the lowest low value of @var{data} for the past
22 ## @var{nperiods} (default: 14) across the dimension, @var{dim}
28 function llv = llow (data, nperiods = 14, dim = find (size (data) > 1, 1))
30 if nargin < 1 || nargin > 3
32 elseif ! isvector (data)
34 error ("cannot yet handle more than one dimensional data")
35 elseif dim > ndims (data)
36 error ("dim cannot be greater than the number of dimensions in data");
42 llv(i) = min (data(max (i-nperiods+1, 1):i));
49 %! c = [22.44 22.61 22.67 22.88 23.36 23.23 23.08 22.86 23.17 23.69 23.77 23.84 24.32 24.8 24.16 24.1 23.37 23.61 23.21 25];
50 %! l = [22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.44 22.61 22.67 22.86 22.86 22.86 22.86];
52 %!assert(llow(c'), l')