Search code examples
matlabevalsymbolic-mathmaple

evaluate numeric part of a "sym" variable


I need to evaluate numeric part of a "sym" variable in MATLAB(something like "evalf" function in maple) for instance I have this sym variable :

(12*(51*EE*II - 8*39^(1/2)*EE*II))/(AA*ll^4*ro)

"evalf" in maple gives me 12.48019224*EE*II/(AA*ll^4*ro), is there any way to do this in MATLAB?


Solution

  • I think that you're looking for the vpa (variable precision arithmetic) function

    syms EE II AA ll ro
    y = (12*(51*EE*II - 8*39^(1/2)*EE*II))/(AA*ll^4*ro)
    vpa(y)
    

    which returns

    ans =
    
    (12.48019215375377223869826038978*EE*II)/(AA*ll^4*ro)