error using double(subs())

37 ビュー (過去 30 日間)
alice W
alice W 2019 年 7 月 4 日
編集済み: alice W 2019 年 7 月 4 日
Hello!
% full code please see EUfin_compute.m
syms x1 x2 x3 x4
EUfinsym=(10000*((1051*x3)/20000 + (1051*x4)/5000)*((1051*x3)/40000 + (1051*x4)/10000)*((23*((1051*x3)/20000 + (1051*x4)/5000)*((1051*x3)/40000 +.....
temp1=vpa(subs(EUfinsym, [x1 x2 x3 x4], [0.3 0.1 0.4 0.2]),6);
EUfin=double(temp1);
I got an error, how did that happen?
Error using symengine
Unable to convert expression into double array.
Error in sym/double (line 672)
Xstr = mupadmex('symobj::double', S.s, 0);

採用された回答

Aiswarya Subramanian
Aiswarya Subramanian 2019 年 7 月 4 日
Hello Alice,
double() cannot be used to convert symbolic expressions. You can instead use vpa() (Variable-Precision Arithmetic). Can you try the following and see if the error still persists?
EUfin=vpa(temp1);
You can also change the precision of vpa() by adding a second Argument to specify the amount of significant Digits. I hope this helps you!
  1 件のコメント
alice W
alice W 2019 年 7 月 4 日
編集済み: alice W 2019 年 7 月 4 日
Thank you very much!
I have found my mistake. Use eval() is OK.
eval(sub())
Ref:

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by