Re: fzero and splines in matlab



On Apr 30, 1:24 pm, "Steven Lord" <s...@xxxxxxxxxxxxx> wrote:
<kniesjenni...@xxxxxxxxxxx> wrote in message

news:1177948733.119018.277770@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Hi all,

I have a dataset that I fit a curve to with the csaps function in
matlab. I would like to find the roots of this curve.
Here is my code and error message:

fun = inline('csaps(x,y,0.2)','x','y');
xroot = fzero(fun,0,[]);

??? Error using ==> fzero
FZERO cannot continue because user supplied inline object ==> fun
failed with the error below.

Error using ==> inline/feval
Not enough inputs to inline function.

'x' and 'y' are respectively temperature and growth rate measures.
These variables are specified earlier in the code.
I would appreciate your help very much,

How many input arguments does FZERO expect your objective function to have?

http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/acc...


How many input arguments does the inline object you're passing to FZERO
have?


You need to make the answers to those two questions agree by changing the
number of inputs the thing you're passing to FZERO has. You'll also need to
consider what your function should return back to FZERO and what it's
actually returning now.

--
Steve Lord
s...@xxxxxxxxxxxxx

Hi Steve,

I see that fzero finds the root of function of 1 variable and I think
I am using 2 variables to define my inline object fun. However, in
order to fit the spline to my data using csaps I do not 2 variables (x
and y). If you have an idea for how to make my function only depend on
1 variable, I would greatly appreciate it. I have tried a number of
different ways of dealing with this I can not figure it out.

Best,
Jen

.



Relevant Pages

  • Re: fzero and splines in matlab
    ... I would like to find the roots of this curve. ... FZERO cannot continue because user supplied inline object ==> fun ... How many input arguments does the inline object you're passing to FZERO ...
    (comp.soft-sys.matlab)
  • Re: roots of a characteristic equation
    ... ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford) wrote: ... many roots, ... using 'fzero' on this function. ... The variable names 'lambda' and 'Lambda' would be regarded ...
    (comp.soft-sys.matlab)
  • Re: roots of a characteristic equation
    ... ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford) wrote: ... many roots, ... using 'fzero' on this function. ... The variable names 'lambda' and 'Lambda' would be regarded ...
    (comp.soft-sys.matlab)
  • Re: roots of a characteristic equation
    ... In article, Jaspreet ... Perhaps a routine like that exists somewhere, ... to tell me how many roots are present and approximately where they lie. ... Note that 'fzero' doesn't guarantee that its results are actually zero ...
    (comp.soft-sys.matlab)
  • Re: Solving a transcendental function
    ... What you do is rewrite as f = x-sinand solve for the roots of f, ... This is what fzero does. ... > doing an fft doesn't make much sense when the input is a scalar so ...
    (comp.soft-sys.matlab)