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

Dursman Mchabe

### Dursman Mchabe (view profile)

님이 질문을 제출함. 21 Oct 2018
최근 활동 Dursman Mchabe

### Dursman Mchabe (view profile)

님이 편집함. 21 Oct 2018
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?

로그인 to comment.

Translated by