not enough input arguments
the error is
coefficient (1) = (vpa(sub(f, x, a))); %storing f(a)
how can I fix this

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 3 月 9 日

0 投票

coefficient(1) = vpa( subs( f, x, a) )
Notice subs not sub
But this assumes that f is a symbolic expression, or a symbolic function, or an anonymous function that has x as one of its variables. This subs() will not work if f is a direct function. For example,
subs(EXAMPLE, x, a)
function y = EXAMPLE(x)
y = x^3-3;
end
will not work -- and neither will subs(@EXAMPLE, x, a) in that case.
You might also have recieved the message if that statement were inside a function and at leat one of f or x or a are named parameters to the function, but you called the function without passing in enough parameters.

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

質問済み:

2023 年 3 月 9 日

回答済み:

2023 年 3 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by