how to evaluate certain part in symbolic calculation?

3 ビュー (過去 30 日間)
Vu
Vu 2014 年 10 月 16 日
コメント済み: Star Strider 2014 年 10 月 16 日
I have a question with respects to a symbolic calculation Here is an example. If I define a,b,x,y as symbols and want to evaluate (a*x*y)/b at a=4,b=3. The mathlab answer was 4xy/3. Is it any way that I can get 1.3333xy instead. Here is my code
syms a b x y
L1=(a*x*y)/b;
subs(L1,{a,b},{4,3})
Thanks, Vu

採用された回答

Star Strider
Star Strider 2014 年 10 月 16 日
Use the vpa function:
syms a b x y
L1=(a*x*y)/b;
vpa(subs(L1,{a,b},{4,3}),5)
produces:
ans =
1.3333*x*y
  2 件のコメント
Vu
Vu 2014 年 10 月 16 日
thanks, it works.
Star Strider
Star Strider 2014 年 10 月 16 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by