is matlab 'fit' function changing behavior ?
10 次查看(过去 30 天)
显示 更早的评论
I was working with curve fitting problem and use fit function as follows :
Now when I am running the code after 2 days, an error pops us saying there are more inputs than expected and correct syntax should be
fit(mdl,data)
I see that the second fit function was introduced in r2022b. does that mean the first fit function from curve fitting toolbox is getting replaced with something else ? If yes, what alternatives can I use in r2022b ?
0 个评论
采纳的回答
Hiro Yoshino
2022-11-2
There are actually many "fit" functions avaiable within MATLAB.
MATLAB determines which "fit" function to use based on the types and the combinations of the input arguments.
For example, the fit provided by Curve Fitting Toolbox is called this way:
load census;
f=fit(cdate,pop,'poly2')
plot(f,cdate,pop)
whereas, the one provided by Predictive Maintenance Toolbox is:
load('linTrainVectors.mat');
mdl = linearDegradationModel;
fit(mdl,linTrainVectors)
mdl
I suppose the function that is available most among the toolboxes is "plot". You can find many plot functions.
0 个评论
更多回答(1 个)
Xingzheng Pan
2022-12-7
Hey all. I still get trouble even use the demo case above. The Matlab still call the fit function in ML toolbox, any ideas to deactivate? I really need the fit function in curve fitting toolbox.
2 个评论
Hiro Yoshino
2022-12-8
I bet you do not own the toolbox(es) required to run the code above.
You do not need deactivate toolboxes you have; MATLAB automatically selects the best one by checking the types and order of the arguments you give to the function.
Xingzheng Pan
2022-12-8
Yeh mate. All fixed now. I realised I don't have curve fitting toolbox installed before.
Have a good day.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!