matlabFunction with syms do not evaluate eqv?

Good day,
Som insight way there is no evaluation for current symbolic function?
When entering…
syms p1 p2 v1 v2 gma
eqv = p1*v1^gma==p2*v2^gma;
p2 = matlabFunction(eqv,p2)
The output is the same function, without evaluation for the requested variable. While it should be p2=p1*(v1/v2)^gma or p2=p1*v1^gma/v2^gma... Is there some error in understanding of the use of current functions?

 採用された回答

Steven Lord
Steven Lord 2020 年 9 月 2 日

0 投票

For what you're describing, matlabFunction is not the right tool. solve is the right tool.

2 件のコメント

Andrew
Andrew 2020 年 9 月 2 日
編集済み: Andrew 2020 年 9 月 2 日
Thank You for spotting my mistyping.
u=symunit;
syms p1 p2 V1 V2 gma
eqn = p1*V1^gma==p2*V2^gma;
p2 = matlabFunction(solve(eqn,p2))
V1 = .15*u.m^3;
p1 = 2*u.bar;
V2 = .02*u.m^3;
gma=1.4;
p2=p2(p1,V1,V2,gma)
p2 =
1.4000*(2*[bar])^(0.0200*[m]^3)/(0.1500*[m]^3)^(0.0200*[m]^3)
Some hint whay ans is in "long form/expresion", when it must be like with
u=symunit;
V1 = .15*u.m^3;
p1 = 2*u.bar;
V2 = .02*u.m^3;
gma=1.4;
p2=p1*(V1/V2)^gma
p2 =
33.5827*[bar]
Steven Lord
Steven Lord 2020 年 9 月 2 日
For future reference we're discussing that over in this other Answers post.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDynamic System Models についてさらに検索

質問済み:

2020 年 9 月 2 日

コメント済み:

2020 年 9 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by