why do I see error in curve fitting?

What I try to run the below example given under the link : https://in.mathworks.com/help/curvefit/fit.html
clear; close all; clc;
load census;
f=fit(cdate,pop,'poly2');
plot(f,cdate,pop);
it throws following error...
Unable to resolve the name curvefit.attention.Error.
Error in fit>iCreateErrorFunction (line 631)
errorFcn = curvefit.attention.Error();
Error in fit (line 107)
errorFcn = iCreateErrorFunction( nargout > 4 );
Can anyone please help?

3 件のコメント

KSSV
KSSV 2021 年 12 月 16 日
What does
which fit
/MATLAB/toolbox/curvefit/curvefit/fit.m
show?
MP
MP 2021 年 12 月 16 日
>> which fit
C:\Program Files\MATLAB\R2021a\toolbox\curvefit\curvefit\fit.m
MP
MP 2021 年 12 月 16 日
The curve fitting toolbox is located at C:\Program Files\MATLAB\R2021a\toolbox\curvefit\curvefit\fit.m
still it gives following error.
Error using cfit
'fittype' requires Curve Fitting Toolbox.
Error in fit>iFit (line 128)
fitobj = cfit;
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...

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

 採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 16 日

0 投票

The Curve Fitting Toolbox needs to be reinstalled.

4 件のコメント

MP
MP 2021 年 12 月 17 日
I tried re-installing, it shows same error.
Is it possible to Copy-Paste C:\Program Files\MATLAB\R2021b\toolbox\curvefit folder from 2021B to C:\Program Files\MATLAB\R2021a\toolbox\curvefit to 2021A? and then Add path C:\Program Files\MATLAB\R2021a\toolbox\curvefit to matlab??
Walter Roberson
Walter Roberson 2021 年 12 月 17 日
No, you cannot use code from a later toolbox together with an earlier MATLAB.
MP
MP 2021 年 12 月 17 日
編集済み: MP 2021 年 12 月 17 日
Thank you for the clarification..
How about the other way round? I have 2017 matlab too.. Can I Copy-Paste 2017 toolbox to 2021 matlab folder and then add to 2021matlab path?
Walter Roberson
Walter Roberson 2021 年 12 月 17 日
It is possible for that message to show up if you have the Curve Fitting Toolbox installed, but somehow do not have a license to use it.
For individual licenses, it is typically only possible to install toolboxes you have a license for, but there are some situations in which it is possible.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

質問済み:

MP
2021 年 12 月 16 日

コメント済み:

2021 年 12 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by