MATLAB: How do you use the function eval

convert to numericdoubleevalmatlab functionmost hated of allnumericsinglesymbolicsymbolic conversion

how would you plug in 2 variables which both contain a 2×1 matrix?

Best Answer

Do not use eval() to turn symbolic expressions into floating point numbers. Use double() if the symbolic expressions contain only constants and functions of constants; use vpa() if the symbolic expressions contain unresolved symbolic variables.
eval() applied to a symbolic variable is not a correct thing to do. Symbolic expressions are in a different programming language that is a hybrid between MATLAB and MuPAD, and if you eval() then MATLAB will attempt to resolve them as-if they are MATLAB code, which they are not. This can be important because some of the symbolic functions take different parameters or take parameters in a different order than the MATLAB function with the same name.