How do I fix: "Undefined function 'fit' for input arguments of type 'function_handle'."?
5 ビュー (過去 30 日間)
古いコメントを表示
I'm not entirely understanding the reason why the follow code doesn't work:
close all; clear all;
x = [2 4 6 8 10];
y = [0.18 0.45-.05 0.85-.1 1.35-.15 2-.2];
fun = @(a,b,c,x) -sqrt(a^2-(x-b).^2)+c;
guess = fun(15,0,15,x); % fun(a,b,c,x)
plot(x,guess,'r:')
fittedmodel = fit(x',y',fun,'StartPoint',[15 0 15])
plot(fittedmodel,'r-');
When I run the code I get the following error:
Undefined function 'fit' for input arguments of type 'function_handle'.
How can I fix this?
Thank you.
0 件のコメント
回答 (1 件)
Walter Roberson
2013 年 10 月 5 日
Which MATLAB version are you using?
Ensure that you have the Curvefitting toolbox installed and licensed. Use
which -all fit
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!