フィルターのクリア

How can I fit data to a curve that is only defined implicitly

2 ビュー (過去 30 日間)
Dursman Mchabe
Dursman Mchabe 2018 年 10 月 21 日
編集済み: Dursman Mchabe 2018 年 10 月 21 日
Hello everyone, I am learning how to fit data to a curve that is only defined implicitly. For practice, I am using the function below:
function yout = myImplicitF(x,AB)
x0 = 0.01;
y0 = 0.01;
A=AB(1);
B=AB(2);
yout = zeros(size(x));
opt = optimset('display','off');
for i=1:length(x)
yout(i) = fsolve(@(y) x(i)- (x0 -(y + B*log(y/y0)+y0)/A), .1, opt);
end
xdata = -5:.1:1;
y = myImplicitF(x,[1 1]) + randn(size(x))/100;
params = [A B];
lsqcurvefit(@(params, xdata) myImplicitF(xdata,params),[0.1 0.1], x, y)
fprintf(1,'\tparams:\n')
for k1 = 1:length(p)
fprintf(1, '\t\tP(%d) = %8.5f\n', k1, p(k1))
end
ezplot(@(x)myImplicitF(x,[1 1]),[-5 1])
end
which gives an error message:
>> myImplicitF
Not enough input arguments.
Error in myImplicitF (line 4)
A=AB(1);
Where am I going wrong?

回答 (0 件)

カテゴリ

Help Center および File ExchangeSmoothing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by