feval

(Not recommended) Evaluate MuPAD expressions specifying their arguments

feval(symengine,...) is not recommended. Use equivalent Symbolic Math Toolbox™ functions that replace MuPAD® functions instead. For more information, see Compatibility Considerations.

Description

example

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.

Examples

Perform MuPAD Command

Find eigenvalues of a matrix.

syms x y
A = [x y; y x];
feval(symengine,'linalg::eigenvalues',A)
ans =
[x + y, x - y]

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

feval(symengine,'linalg::eigenvalues','matrix([[x,y],[y,x]])')
ans =
[x + y, x - y]

Input Arguments

collapse all

Input specified as a MuPAD function name or symbolic object.

Arguments specified as symbolic expressions.

Output Arguments

collapse all

Computation result returned as a symbolic object or character vector containing a MuPAD error message.

Error status returned as an integer. If F with the arguments x1,...,xn executes without errors, the error status is 0.

Tips

  • 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.

Compatibility Considerations

expand all

Not recommended starting in R2018b

Introduced in R2008b