Convert output from symbolic math (sym) to float

后端 未结 2 545
醉话见心
醉话见心 2020-11-30 15:52

My question is similar to this question but I believe it to be more general.
I use Matlab\'s symbolic math toolbox to solve an equation:

MAZ = 0.5;
MAU         


        
2条回答
  •  悲&欢浪女
    2020-11-30 16:17

    While double is correct, it is limited to the precision of 64bit floating points. Use vpa if a higher precision is needed:

    >> vpa(a)
    
    ans =
    
      5.9892107832014511063435699584181
     0.83483453513174202459587915406938
    
    >> digits(99)
    
    >> vpa(a)
    
    ans =
    
      5.98921078320145110634356995841813862213621375395128614574627036653958858547362556353272837962692249
     0.834834535131742024595879154069378868157531819123064337100994463734092031618244369410214559292265698
    

提交回复
热议问题