how shall I replace "inline" function by anonymous function

if true
myfunc=inline('beta(1)*x+beta(2)','beta','x');
[~,r]=nlinfit(x,y,myfunc,[1,1]);
end
I code as above and Matlab remind me that "inline" will be replaced by anonymous function and deleted in future;
Now how shall I replace "inline" function by anonymous function?

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 1 月 23 日

1 投票

myfunc = @(beta,x) beta(1)*x + beta(2)

1 件のコメント

Stephen23
Stephen23 2017 年 1 月 23 日
vx2008's "Answer" moved here:
thanks a lot.

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

カテゴリ

ヘルプ センター および File ExchangeFunction Creation についてさらに検索

質問済み:

2017 年 1 月 23 日

コメント済み:

2017 年 1 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by