Search code examples
matlabsymbolic-mathvariable-declarationfloating-point-conversion

How to get value of symbolic expression for further processing


When using symbolic expression, the question is how to convert symbolic value to discrete value and obtain z value.

x=2
syms x
y=x^2

z=x+y

Solution

  • syms x y
    y = x^2
    z = x+y
    
    y_function = matlabFunction(y);
    z_function = matlabFunction(z);
    
    x = 2;
    z_function(2)