STILL confused on Solver (tried a different approach) NOT SPAM

조회 수: 5 (최근 30일)
Rebecca Reyes
Rebecca Reyes 2021년 4월 13일
댓글: Rebecca Reyes 2021년 4월 14일
please look over my new attempt
the answer for x is suppposed to be 88. I can't seem to get the answer
I am not trying to spam I just tried a new approach. Please Please help.
This is my approach.
clear dlc
%feed composition
z1=.5;
z2=.1;
z3=.15;
z4=.25;
%other given data
F=150;
PD=250;
T=10;
L=150-x;
F=150;
%k-values from chart yi/xi
k1=56;
k2=0.65;
k3=0.175;
k4=0.055;
%total balances
x1=(F*z1)/(k1*x+L);
x2=(F*z2)/(k2*x+L);
x3=(F*z3)/(k3*x+L);
x4=(F*z4)/(k4*x+L);
eqn=k1*x1+k2*x2+k3*x3+k4*x4==1;
sol=solve(eqn);
The only answer I get in command window this time is
>> Project (which is the name of the file)
  댓글 수: 4
Cris LaPierre
Cris LaPierre 2021년 4월 13일
You haven't declared what x is, so your code is returning an error. Did you mean to make it symbolic?
Rebecca Reyes
Rebecca Reyes 2021년 4월 13일
Yes, i think? x is what I'm hoping to solve for in the solver.

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

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 4월 13일
Assuming x is symbolic
%feed composition
z1=.5;
z2=.1;
z3=.15;
z4=.25;
%other given data
F=150;
PD=250;
T=10;
syms x
L=150-x;
%k-values from chart yi/xi
k1=56;
k2=0.65;
k3=0.175;
k4=0.055;
%total balances
x1=(F*z1)/(k1*x+L);
x2=(F*z2)/(k2*x+L);
x3=(F*z3)/(k3*x+L);
x4=(F*z4)/(k4*x+L);
eqn=k1*x1+k2*x2+k3*x3+k4*x4==1
eqn = 
sol=solve(eqn)
sol = 
double(sol)
ans = 4×1
150.0000 88.6523 173.8927 395.3987
It looks like there are 4 possible solutions to your equation, of which, a value close to 88 is one of them. If I solve your equation substituting in a value of 88, the result is close to 1.
double(subs(lhs(eqn),x,88))
ans = 1.0052
  댓글 수: 3
Cris LaPierre
Cris LaPierre 2021년 4월 14일
If you use the exact values returned, every one of them will give you a result of 1. Otherwise, they wouldn't be a solution to the equation. It sounds like you need to maybe come up with a constraint for the solution, like it must be less than 100, for example.
Rebecca Reyes
Rebecca Reyes 2021년 4월 14일
Oh I see. Thank you!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by