help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Name of fnval.m on octave-forge?


From: Paul Kienzle
Subject: Re: Name of fnval.m on octave-forge?
Date: Sun, 22 Feb 2004 21:36:12 -0500


On Feb 22, 2004, at 8:22 PM, Henry F. Mollet wrote:

I found the following functions files on octave-forge that I needed to try
to run an example in a program available at
http://www.esapubs.org/archive/ecol/E081/007/suppl-1.htm:

prctile.m (for percentiles);
fmins.m (find minimum of a function of several variables);
nmsmax.m (Nelder-Mead simplex method);
csapi.m (cubic spline interpolation);
csape.m (cubic spline with various end conditions);
mkpp.m (constructs a piece-wise polynomial);

I next got stuck on fnval.m but could not find it on octave-forge. It
probably has a different name? A Google search indicated that it is
available in the matlab toolbox and the function only has a few lines of
code.

Can you use ppval(pp,x)?

From the web, it sounds like fnval(x,pp) == fnval(pp,x) == ppval(pp,x),
so a simple approximation would be:

## r = fnval(pp,x) or r = fnval(x,pp)
## Compute the value of the piece-wise polynomial pp at points x.
function r = fnval(a,b,left)
  if nargin == 2 || (nargin == 3 && left == 'l' && left == 'r')
    # XXX FIXME XXX ignoring left continuous vs. right continuous option
    if isstruct(a), r=ppval(a,b); else r=ppval(b,a); end
  else
    usage("r=fnval(pp,x) || r=fnval(x,pp)");
  end
end

Let me know if it works for youu and I can add it to octave-forge.

Note that the spline functions will stay out of Octave until someone
can confirm that the splines produced are reasonable, and fix them
if they are not.

The tests we have only confirm that the returned shape for the y
vector matches that of the x vector, and that the ppval at the knots
matches the y value at the knots.  Our tests do not check that the
derivatives at the knots or the values between the knots are
reasonable.

Paul Kienzle
address@hidden



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]