empty sym error, how to solve

조회 수: 2 (최근 30일)
esat gulhan
esat gulhan 2020년 8월 20일
댓글: Adam Danz 2020년 8월 22일
syms P1 P2 V1 V2 z1 z2 g p debi Wpump Wturb Eloss Wpumpshaft npump nturb alfa1 alfa2
g=9.807
p=1000
V1=0
z1=0
alfa1=1;
P2=0
V2=1
z2=0
alfa2=1;
debi=70 %kg/sn
Wpumpshaft=20100
npump=0.683074626865671
Wpump=Wpumpshaft*npump
Wturb=0;
nturb=1
Eloss=0;
ar=((P1/p+V1^2/(2)*alfa1+z1*g)*debi+Wpump==(P2/p+V2^2/(2)*alfa2+z2*g)*debi+Wturb*nturb+Eloss);
vpa(solve(ar,P1),8)
when i try to solve this it give error. it is ridiculuous. Where is the error.
  댓글 수: 1
Adam Danz
Adam Danz 2020년 8월 22일
When I run this, I do not get an error.

댓글을 달려면 로그인하십시오.

채택된 답변

Alan Stevens
Alan Stevens 2020년 8월 22일
You could use fzero:
P10 = -100;
P1 = fzero(@fn, P10);
function F = fn(P1)
g=9.807;
p=1000;
V1=0;
z1=0;
alfa1=1;
P2=0;
V2=1;
z2=0;
alfa2=1;
debi=70; %kg/sn
Wpumpshaft=20100;
npump=0.683074626865671;
Wpump=Wpumpshaft*npump;
Wturb=0;
nturb=1;
Eloss=0;
F = ((P1/p+V1^2/(2)*alfa1+z1*g)*debi+Wpump ...
- (P2/p+V2^2/(2)*alfa2+z2*g)*debi+Wturb*nturb+Eloss);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion 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