On Mon, Aug 03, 2009 at 06:33:09AM -0700, roessli bertrand wrote:
> > > -I added a varargin variable to leasqr.m to allow pass additional
> > > parameters. 
> 
> "This should be unnecessary since one can use anonymous functions for
> passing additional parameters to the user function. "
> 
> Can you provide an example please?
> 
> Thank You,
> 
> Bertrand

Here is an example:

octave:1> function ret = f (x, p, additional_p)
>  ret = log (x + p(1)) + additional_p.base;
> endfunction
octave:2> [y, p, cvg] = leasqr ((1:10)(:), [1.7; 1.8; 1.9; 1.9; 1.95; 2.0; 
2.05; 2.1; 2.05; 2.2], [0], @ (x_anon, p_anon) feval ("f", x_anon, p_anon, 
struct ("base", 1)))
y =

   0.91618
   1.65211
   2.07144
   2.36599
   2.59323
   2.77827
   2.93436
   3.06934
   3.18825
   3.29451

p = -0.080407
cvg =  1
octave:3> 

Regards, Olaf

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to