How do i fix this error?
조회 수: 5 (최근 30일)
이전 댓글 표시
Here's my code, I'm trying to fit a arctangent function to data,
years = xlsread('C:\Users\a\Desktop\WorldPopulation', 'A1:CO1');
population = xlsread('C:\Users\a\Desktop\WorldPopulation', 'A2:CO2');
x = years.';
y = population.';
FO = fitoptions('Display','iter',...
'StartPoint',[4100 0.02 -39.7 6500],...
'MaxIter','2000',...
'MaxFuncEval','3000');
FT = fittype('a.*atan(c.*x+d)+b', 'options', FO);
[min, gof] = fit(x, y, FT);
But I keep getting the error
Error using curvefit.basefitoptions/set
The name 'Display' is not an accessible property for an instance of class 'basefitoptions'.
Error in fitoptions (line 189)
set(f,varargin{:});
Error in OptimizeCurve (line 15)
FO = fitoptions('Display','iter',...
How do i fix this?
댓글 수: 0
답변 (1개)
Stephan
2019년 3월 17일
Hi,
the Display option is only avaiable if the fitting method is nonlinear least squares:
The default Method is 'None' (which appears strange). I would expect, that it works, when you set:
FO = fitoptions('Method', 'NonlinearLeastSquares', 'Display','iter',...
'StartPoint',[4100 0.02 -39.7 6500], 'MaxIter','2000',...
'MaxFuncEval','3000');
Best regards
Stephan
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!