1 ## Copyright (C) 1995-1998, 2000, 2002, 2005-2007 Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
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{v} =} pvl (@var{r}, @var{n}, @var{p})
18 ## Return the present value @var{v} of an investment that will pay off @var{p}
19 ## in one lump sum at the end of @var{n} periods, given the interest
22 ## Note that the rate @var{r} is specified as a fraction (i.e., 0.05,
26 function v = pvl (r, n, p)
32 if (! (isscalar (r) && (r > -1)))
33 error ("pvl: r has to be a scalar > -1");
34 elseif (! (isscalar (n) && n > 0))
35 error ("pvl: n has to be a positive scalar");
36 elseif (! isscalar (p))
37 error ("pvl: p has to be a scalar");