Undefined operator '+' for input arguments of type 'function_handle'.

回答 (1 件)

Star Strider
Star Strider 2017 年 11 月 2 日

0 投票

I cannot reproduce that error with the code you posted (assuming ‘kh_1’, ‘hrootzone’, and ‘hgwt’ are double-precision values).
As a general rule, if you want to add (or do other operations on) functions, you have to evaluate them as functions.
Example —
f1 = @(x) x.^2;
f2 = @(x) 2*x;
f3 = @(x) f1(x) + f2(x); % Create New Anonymous Function To Sum Other Functions
x = 2;
y = f3(x);

カテゴリ

ヘルプ センター および File Exchange で Just for fun についてさらに検索

質問済み:

2017 年 11 月 2 日

回答済み:

2017 年 11 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by