필터 지우기
필터 지우기

How to use Solver?

조회 수: 3 (최근 30일)
Rebecca Reyes
Rebecca Reyes 2021년 4월 13일
편집: madhan ravi 2021년 4월 14일
clear dlc
%feed composition
z1=.5;
z2=.1;
z3=.15;
z4=.25;
%other given data
F=150;
PD=250;
T=10;
F=150;
%k-values from chart yi/xi
k1=56;
k2=0.65;
k3=0.175;
k4=0.055;
%total balances
syms x
eqn=solve(k1*((F*z1)/(k1*x+150-x))+k2*((F*z2)/(k2*x+150-x))+k3*((F*z3)/(k3*x+150-x))+k4*((F*z4)/(k4*x+150-x))==1)
I'm trying to solve for x in the eqn but all i get is this:
eqn =
150
root(z^3 - (151985*z^2)/231 + (2120672000*z)/17787 - 36140000000/5929, z, 1)
root(z^3 - (151985*z^2)/231 + (2120672000*z)/17787 - 36140000000/5929, z, 2)
root(z^3 - (151985*z^2)/231 + (2120672000*z)/17787 - 36140000000/5929, z, 3)
Very confused since I had defined my z constants and I am only looking for the x variable

채택된 답변

madhan ravi
madhan ravi 2021년 4월 13일
Use vpasolve()
  댓글 수: 6
Rebecca Reyes
Rebecca Reyes 2021년 4월 13일
편집: Rebecca Reyes 2021년 4월 13일
I see what you are trying to tell me but i see that my approach is all wrong for what i need to get as an answer.
i redid my coding since my answer is supposed to be just one number 88.
I posted it on another post.
Thank you for your help.
madhan ravi
madhan ravi 2021년 4월 14일
편집: madhan ravi 2021년 4월 14일
Wow , you just completely ignored what I told you and simply asked the same question.
%feed composition
z1=.5;
z2=.1;
z3=.15;
z4=.25;
%other given data
F=150;
PD=250;
T=10;
F=150;
%k-values from chart yi/xi
k1=56;
k2=0.65;
k3=0.175;
k4=0.055;
%total balances
syms x
Eqn = k1*((F*z1)/(k1*x+150-x))+k2*((F*z2)/(k2*x+150-x))+k3*((F*z3)/(k3*x+150-x))+k4*((F*z4)/(k4*x+150-x))==1;
X = vpasolve(Eqn) % you can see 4 answers so if you're looking for the root in a certain range say 50 - 100 you can use the below line
X = 
X_in_the_range = vpasolve(Eqn, [50 100])
X_in_the_range = 
88.652321154384366746951471346875
subs(Eqn, X_in_the_range) % to check if it satisfies, ofcourse it's not an exact solution but a close match to what you're looking for
ans = 
Come on , was that hard for you ? The reason I suggested vpasolve() is that you can input the domain for the solver to look for. Please stop asking the same question multiple times just because you didn't understand. It's not encouraged in this forum. Volunteers spend some time in helping and instead of giving them a proper response OP's tend to ask another question simultaneously.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by