From: Aino on
Hi All,

I am having trouble with fitting. Here's a simple version of what I am trying:

clear all
x=[1:100];
y=0.1*sin(x)+2;
s = fitoptions('Method','LinearLeastSquares','Lower',[0 0]);
ffun = fittype('a*sin(x)+b','coefficients',{'a','b'},'independent','x','options',s);
f=fit(x',y',ffun)

And here's what I get:
??? No appropriate method, property, or field startpoint for class
curvefit.llsqoptions.

Error in ==> fit at 325
start = options.startpoint;

Matlab helps tells me that when I have "LinearLeastSquares" as a method I have the option to set a lower limit to the fit. This is driving me crazy.. I need to get the lower limit to the fit since the function I am really using in my code -log(a^x+b^x)/log(2) calculates complex values when x is a negative integer, and a and b are negative and my code stops there.

Thank You for your help.

-Aino
From: us on
"Aino" <aino.tietavainen(a)removeThis.helsinki.fi> wrote in message <i1bcd4$o8i$1(a)fred.mathworks.com>...
> Hi All,
>
> I am having trouble with fitting. Here's a simple version of what I am trying:
>
> clear all
> x=[1:100];
> y=0.1*sin(x)+2;
> s = fitoptions('Method','LinearLeastSquares','Lower',[0 0]);
> ffun = fittype('a*sin(x)+b','coefficients',{'a','b'},'independent','x','options',s);
> f=fit(x',y',ffun)
>
> And here's what I get:
> ??? No appropriate method, property, or field startpoint for class
> curvefit.llsqoptions.
>
> Error in ==> fit at 325
> start = options.startpoint;
>
> Matlab helps tells me that when I have "LinearLeastSquares" as a method I have the option to set a lower limit to the fit. This is driving me crazy.. I need to get the lower limit to the fit since the function I am really using in my code -log(a^x+b^x)/log(2) calculates complex values when x is a negative integer, and a and b are negative and my code stops there.
>
> Thank You for your help.
>
> -Aino

which ver of ML and the curve fitting tbx do you have(?)...

us
From: Aino on
"us " <us(a)neurol.unizh.ch> wrote in message <i1c50h$l32$1(a)fred.mathworks.com>...
> "Aino" <aino.tietavainen(a)removeThis.helsinki.fi> wrote in message <i1bcd4$o8i$1(a)fred.mathworks.com>...
> > Hi All,
> >
> > I am having trouble with fitting. Here's a simple version of what I am trying:
> >
> > clear all
> > x=[1:100];
> > y=0.1*sin(x)+2;
> > s = fitoptions('Method','LinearLeastSquares','Lower',[0 0]);
> > ffun = fittype('a*sin(x)+b','coefficients',{'a','b'},'independent','x','options',s);
> > f=fit(x',y',ffun)
> >
> > And here's what I get:
> > ??? No appropriate method, property, or field startpoint for class
> > curvefit.llsqoptions.
> >
> > Error in ==> fit at 325
> > start = options.startpoint;
> >
> > Matlab helps tells me that when I have "LinearLeastSquares" as a method I have the option to set a lower limit to the fit. This is driving me crazy.. I need to get the lower limit to the fit since the function I am really using in my code -log(a^x+b^x)/log(2) calculates complex values when x is a negative integer, and a and b are negative and my code stops there.
> >
> > Thank You for your help.
> >
> > -Aino
>
> which ver of ML and the curve fitting tbx do you have(?)...
>
> us

I just switched form 2009b to 2010a, my toolbox seems to be v2.2. Does this work with your Matlab?

-Aino
From: Aino on
"us " <us(a)neurol.unizh.ch> wrote in message <i1c50h$l32$1(a)fred.mathworks.com>...
> "Aino" <aino.tietavainen(a)removeThis.helsinki.fi> wrote in message <i1bcd4$o8i$1(a)fred.mathworks.com>...
> > Hi All,
> >
> > I am having trouble with fitting. Here's a simple version of what I am trying:
> >
> > clear all
> > x=[1:100];
> > y=0.1*sin(x)+2;
> > s = fitoptions('Method','LinearLeastSquares','Lower',[0 0]);
> > ffun = fittype('a*sin(x)+b','coefficients',{'a','b'},'independent','x','options',s);
> > f=fit(x',y',ffun)
> >
> > And here's what I get:
> > ??? No appropriate method, property, or field startpoint for class
> > curvefit.llsqoptions.
> >
> > Error in ==> fit at 325
> > start = options.startpoint;
> >
> > Matlab helps tells me that when I have "LinearLeastSquares" as a method I have the option to set a lower limit to the fit. This is driving me crazy.. I need to get the lower limit to the fit since the function I am really using in my code -log(a^x+b^x)/log(2) calculates complex values when x is a negative integer, and a and b are negative and my code stops there.
> >
> > Thank You for your help.
> >
> > -Aino
>
> which ver of ML and the curve fitting tbx do you have(?)...
>
> us

I just switched form 2009b to 2010a, my toolbox seems to be v2.2. Does this work with your Matlab?

-Aino
From: Aino on
I just tried this with the 2009b version and it doesn't work. I changed the LinearLeastSquares to NonlinearLeastSquares and that worked. I would have preferred the Linear one, but if this works than I guess that's fine..

If anybody figures that Linear problem out, please let me know.

-Aino