Solve for one variable

조회 수: 3 (최근 30일)
Sumeet Sinha
Sumeet Sinha 2021년 5월 4일
답변: Star Strider 2021년 5월 4일
this is the code for which i want tk solve for p :
syms p
A=0.1199;
At=0.112;
y=1.43;
P1=119;
Error =0.01123;
eqn= ((At^2)/(A^2))==(((y+1)/2)^((y+1)/(y-1)))*(2/(y-1))*(((p/P1)^(2/y))-((p/P1)^(y+1/y)))
solve( eqn,p )
there is only one issue when i run it and that is the eqn shown in command window is completely different from what declared. For example in command type
eqn
The lhs is very different from what i declared for At and A.

답변 (1개)

Star Strider
Star Strider 2021년 5월 4일
It really is not at all different, except the format.
Examing it —
syms p
A=0.1199;
At=0.112;
y=1.43;
P1=119;
Error =0.01123;
eqn= ((At^2)/(A^2))==(((y+1)/2)^((y+1)/(y-1)))*(2/(y-1))*(((p/P1)^(2/y))-((p/P1)^(y+1/y)))
eqn = 
solve( eqn,p )
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
ans = 
20.676508138624863263582165888508
Different format, however same value —
LHS_eqn = lhs(eqn)
LHS_eqn = 
LHS_eqn_dec = vpa(LHS_eqn)
LHS_eqn_dec = 
0.87256477979634128328001452246099
At_squared = At^2
At_squared = 0.0125
A_squared = A^2
A_squared = 0.0144
LHS_frac = At_squared / A_squared
LHS_frac = 0.8726
LHS_dec = vpa(LHS_frac)
LHS_dec = 
0.87256477979634128328001452246099
.

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by