MATLAB Answers

fit function in Matlab 2020

225 ビュー (過去 30 日間)
Felipe Flores-Golfin
Felipe Flores-Golfin 2020 年 6 月 5 日
コメント済み: Zhixue 2020 年 10 月 19 日
I'm trying to use the fit function (see example below), but keep getting this error "Check for missing argument or incorrect argument data type in call to function 'fit' "
% Code:
load census;
f=fit(cdate,pop,'poly')
%
I get the error even using this simple example, which is the same one that appears here Fit Help Doc
Thanks in advance for the help. I'm not sure how to fix this.

  0 件のコメント

サインインしてコメントする。

回答 (1 件)

Navya Seelam
Navya Seelam 2020 年 6 月 8 日
poly is not a valid input argument for the fit function. Try using poly1 or poly2 for linear and quadratic fit respectively. For more valid fit types go through this link.

  3 件のコメント

JP
JP 2020 年 9 月 11 日
Hi Navya,
I have the same problem, also when using poly1 or poly2:
load census;
f=fit(cdate,pop,'poly1');
plot(f,cdate,pop)
I use Matlab 2020a.
Do you know what's the problem?
Best
Steven Lord
Steven Lord 2020 年 9 月 11 日
Do you have Curve Fitting Toolbox installed?
Zhixue
Zhixue 2020 年 10 月 19 日
Same here, fit function not working. Has MABLAB changed anything?

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by