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

1 visualización (últimos 30 días)
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 comentarios
Cris LaPierre
Cris LaPierre el 13 de Abr. de 2021
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 el 13 de Abr. de 2021
Yes, i think? x is what I'm hoping to solve for in the solver.

Iniciar sesión para comentar.

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 13 de Abr. de 2021
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 comentarios
Cris LaPierre
Cris LaPierre el 14 de Abr. de 2021
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.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by