problem with fit function for data
1 回表示 (過去 30 日間)
古いコメントを表示
I have a problem with getting the fit function to work
clear; clc;
E = [416.861, 818.7, 1097.3, 1293.54,1507.4];
e = flip([1.7e-1, 1.6870e-1, 2.045e-1, 1.956e-1, 6.255e-1]);
f = fit(E,e,'exp1');
plot(f,E,e,'rx','markersize',8)
grid on
this gives me this error:
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Error in Untitled2 (line 6)
f = fit(E,e,'exp1');
No idea why this happens, and I do have ethe curve fitting toolbox installed.
0 件のコメント
採用された回答
Star Strider
2021 年 9 月 22 日
The fit function requires column vector arguments. Force that sith the ‘(:)’ subscript noitation.
E = [416.861, 818.7, 1097.3, 1293.54,1507.4];
e = flip([1.7e-1, 1.6870e-1, 2.045e-1, 1.956e-1, 6.255e-1]);
f = fit(E(:),e(:),'exp1');
hp = plot(f,E,e,'rx');
hp(1).MarkerSize = 8;
grid on
The other problem is that the 'MarkerSize' is ambiguous here, since both the data and fit are plotted, so use that as a separate assignment and reference the appropriate line object.
.
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!