Not enough input arguments in lsqcurvefit function

xdata is 744x1 double vector
ydata is 744x1 double vector
function consists of
function ydata=calcor(k,xdata)
ydata=1-(1-k)*(xdata.^k);
end
x0=[0 0]
lsqcurvefit is written like below
k= lsqcurvefit(calcor,x0,xdata,ydata);
it keeps giving me not enough input argument error.
Not enough input arguments.
Error in calcor (line 2)

답변 (1개)

Torsten
Torsten 2023년 4월 5일
x0 = 0
not
x0 = [0 0]
since k seems to be a scalar as you treat it in "calcor".
Further I guess
k= lsqcurvefit(@calcor,x0,xdata,ydata);
instead of
k= lsqcurvefit(calcor,x0,xdata,ydata);

댓글 수: 2

Thanks for helping
@calcor helped however it is giving me another error message. Could you please check it?
Could you please check it?
I will, but where is it ?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Matrix Computations에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2023년 4월 5일

댓글:

2023년 4월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by