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

Réponses (1)

Walter Roberson
Walter Roberson le 9 Mar 2023

0 votes

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.

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by