This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Evaluate MuPAD expressions specifying their arguments


result = feval(symengine,F,x1,...,xn)
[result,status] = feval(symengine,F,x1,...,xn)


result = feval(symengine,F,x1,...,xn) evaluates F, which is either a MuPAD® function name or a symbolic object, with arguments x1,...,xn. Here, the returned value result is a symbolic object. If F with the arguments x1,...,xn throws an error in MuPAD, then this syntax throws an error in MATLAB®.

[result,status] = feval(symengine,F,x1,...,xn) lets you catch errors thrown by MuPAD. This syntax returns the error status in status, and the error message in result if status is nonzero. If status is 0, result is a symbolic object. Otherwise, result is a character vector.

Input Arguments


MuPAD function name or symbolic object.


Arguments of F.

Output Arguments


Symbolic object or character vector containing a MuPAD error message.


Integer indicating the error status. If F with the arguments x1,...,xn executes without errors, the error status is 0.


syms a b c x
p = a*x^2+b*x+c;
feval(symengine,'polylib::discrim', p, x)
ans =
b^2 - 4*a*c

Alternatively, the same calculation based on variables not defined in the MATLAB workspace is:

feval(symengine,'polylib::discrim', 'a*x^2 + b*x + c', 'x')
ans =
b^2 - 4*a*c

Try using polylib::discrim to compute the discriminant of the following nonpolynomial expression:

[result, status] = feval(symengine,'polylib::discrim',...
                                   'a*x^2 + b*x + c*ln(x)', 'x')
result =
  1×39 char array
An arithmetical expression is expected.

status =

Related Examples


evalin lets you evaluate MuPAD expressions without explicitly specifying their arguments.

More About

collapse all


  • Results returned by feval can differ from the results that you get using a MuPAD notebook directly. The reason is that feval sets a lower level of evaluation to achieve better performance.

  • feval does not open a MuPAD notebook, and therefore, you cannot use this function to access MuPAD graphics capabilities.

See Also

| |

Introduced in R2008b

Was this topic helpful?