Undefined function for input arguments of type 'double' - fit function

I'm running the following code:
close all
clear
clc
x = [0:0.01:1];
A=[0.0; 0.2; 0.4; 0.6; 0.8; 1.0];
B=[0.0; 0.034; 0.12; 0.267; 0.5; 1.0];
f=fit(A,B,'poly2')
But it results in the following error:
Undefined function 'fit' for input arguments of type 'double'.
Error in filename (line 68)
f=fit(A,B,'poly2')
I checked that the folder is in the correct path.
Help is appreciated.

 採用された回答

Guillaume
Guillaume 2018 年 12 月 23 日

3 投票

Most likely you don't have the curve fitting toolbox installed or you don't have a license for it.

6 件のコメント

madhan ravi
madhan ravi 2018 年 12 月 23 日
+1 right point
Guillaume
Guillaume 2018 年 12 月 23 日
I do have it installed: Statistics and Machine Learning Toolbox Version 11.3 (R2018a)
fit is part of the Curve Fitting Toolbox not the Statistics toolbox.
madhan ravi
madhan ravi 2018 年 12 月 23 日
True..
Jochem
Jochem 2018 年 12 月 23 日
Thanks for the help.
It was indeed the Curve Fitting Toolbox that wasn't installed. No idea why it wasn't installed, because it's part of the standard suite.
Georgios Tsimplis
Georgios Tsimplis 2020 年 7 月 26 日
編集済み: Georgios Tsimplis 2020 年 7 月 26 日
I did it !!!! it works! thanks for your help!
madhan ravi
madhan ravi 2020 年 7 月 26 日
Georgios isn’t that what I told you in your question?

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

その他の回答 (1 件)

madhan ravi
madhan ravi 2018 年 12 月 23 日

1 投票

What does the below show?
which fit -all
whos fit

4 件のコメント

Jochem
Jochem 2018 年 12 月 23 日
C:\Program Files\MATLAB\R2018a\toolbox\stats\stats\@gmdistriution\fit.m % gm distritbution method
madhan ravi
madhan ravi 2018 年 12 月 23 日
編集済み: madhan ravi 2018 年 12 月 23 日
You are missing two files:
/Applications/MATLAB_R2018b.app/toolbox/curvefit/curvefit/fit.p
/Applications/MATLAB_R2018b.app/toolbox/curvefit/curvefit/fit.m
Two options you have got now:
1) As Guillaume says either you would not be having Curve Fitting Toolbox installed or have a license for it , so you will have a question how to check those:
ver % in command window , check whether you have Statistics and Machine Learning Toolbox
license('checkout','Curve_Fitting_Toolbox') % if it returns 1 then you have a valid license
2) If the first option fails get the two files by contacting the Mathworks Support Team by clicking the Contact Us button on the top right corner of this page.
EDIT : Sorry Guillaume didn't notice your answer properly.
Jochem
Jochem 2018 年 12 月 23 日
I do have it installed:
Statistics and Machine Learning Toolbox Version 11.3 (R2018a)
madhan ravi
madhan ravi 2018 年 12 月 23 日
So just follow my second option .

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

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

質問済み:

2018 年 12 月 23 日

コメント済み:

2020 年 7 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by