[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Name of fnval.m on octave-forge?
From: |
Henry F. Mollet |
Subject: |
Re: Name of fnval.m on octave-forge? |
Date: |
Mon, 23 Feb 2004 10:40:26 -0800 |
User-agent: |
Microsoft-Entourage/10.1.1.2418 |
on 2/22/04 6:36 PM, Paul Kienzle at address@hidden wrote:
>
> 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
WOW, this is amazing! I even got three out of 4 plots and was convinced the
matlab code for graphs at least would need some changes to work on octave
and it would takes weeks to get that far. Now I have something to work with
and can check the results, which will take some time as I have to use other
than default input parameters and more, including learning about spline
fitting.
I should also add that the authors of the program included the following
NOTE: The spline option currently requires that you have the Matlab Spline
Toolbox installed. We plan on removing this requirement in a future release.
I replaced the existing code in fnval.m with the code given above and just
tried:
error: `lookup' undefined near line 35 column 11
error: called from `ppval' in file
I added lookup.m from octave-forge and then it worked. Next item is to work
on "get" (=matlab handle graphics operation, get object properties, see
N.B)
Many thanks, Henry
N.B.
octave:6> [grow_rates, kmat,mshpts]=lambda(testdata, [],[],[],[],[])
Using default (5) stages for a matrix model
Using default values for fitting
Using default values for regression order
error: `get' undefined near line 109 column 7 % in grow.m called by lambda.m
Code was h = get (gca, 'Children"); set (h, 'FaceColor', 'w');
for a histogram plot.
-------------------------------------------------------------
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
-------------------------------------------------------------