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 日

1 投票

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 件のコメント

Batula
Batula 2023 年 4 月 5 日
Thanks for helping
@calcor helped however it is giving me another error message. Could you please check it?
Torsten
Torsten 2023 年 4 月 5 日
Could you please check it?
I will, but where is it ?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMatrix 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