Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LinearLeastSquares fitting - error

88 views
Skip to first unread message

Andrej Panjan

unread,
Mar 25, 2008, 4:53:02 AM3/25/08
to
I have MATLAB 7.5.0. I get an error when I use
LinearLeastSquares method in fit function. Here is code I use

"nls = fitoptions('Method','LinearLeastSquares');
gaussT = fittype('a * x.^2 + b * x + c','options',nls);
[gaussNLS gaussNLSgof] = fit(data(LV:RV,1), data(LV:RV,2),
gaussT)"

and error I get

"??? No appropriate method or public field startpoint for
class curvefit.llsqoptions.

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

Error in ==> CurveFit>Calculate_Callback at 236
[gaussNLS gaussNLSgof] = fit(data(LV:RV,1),
data(LV:RV,2), gaussT)"

but if I set Startpoint

"nls=fitoptions('Method','LinearLeastSquares','Startpoint',[1
1 1]);
gaussT = fittype('a * x.^2 + b * x + c','options',nls);
[gaussNLS gaussNLSgof] = fit(data(LV:RV,1), data(LV:RV,2),
gaussT)"

I get error

"??? There is no 'Startpoint' property in the 'llsqoptions'
class.

Error in ==> fitoptions at 195
set(f,varargin{:});

Error in ==> CurveFit>Calculate_Callback at 234
nls =
fitoptions('Method','LinearLeastSquares','Startpoint',[1 1 1]);"

What am I doing wrong?
Is there any example of LinearLeastSquares fit?

Thanks!
andrej

Peter Nagy

unread,
Sep 19, 2009, 11:50:22 AM9/19/09
to
I had the same problem. The solution can be found in the Matlab help of the function 'islinear':

islinear assumes that all custom models specified by the fittype function using the syntax ftype = fittype('expr') are nonlinear models. To create a linear model with fittype that will be recognized as linear by islinear (and, importantly, by the algorithms of fit), use the syntax ftype = fittype({'expr1','expr2',...,'exprn'}).

Peter

0 new messages