solving system of multiple equations

My code is:
syms BF1 BF2 BF3 BF4 CO COreq
eqn1 = BF3(i)==0.012*CO;
eqn2 = BF1(i)==0.92*CO;
eqn3 = BF4(i)==MaxBFvsk*PctBF*1000;
eqn4 = BF2(i)==(100*MuVO2)/(0.8*210);
eqn5 = COreq==BF1(i)+BF2(i)+BF3(i)+BF4(i);
eqn6 = CO==min(COmax,COreq);
[BF1(i),BF2(i),BF3(i),BF4(i),CO,COreq]=solve(eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,BF1(i),BF2(i),BF3(i),BF4(i),CO,COreq);
Where MaxBFvsk, PctBF, MuVO2, COmax are all constants.
And it doesn't work because of equation 6, the error says:
Error using sym/min (line 98) Input arguments must be convertible to floating-point numbers.
Error in test (line 148) eqn6 = CO==min(COmax,COreq); %ml/min CO=HRR*SV is another method
I am not sure how to correct this problem.

 Respuesta aceptada

Star Strider
Star Strider el 7 de Oct. de 2015

0 votos

‘Where MaxBFvsk, PctBF, MuVO2, COmax are all constants.’
You have to define them after the syms call. If ‘COmax’ and ‘COreq’ contain any symbolic variables (I did not run your code), that line will also throw an error.
You might also want to use the vpasolve function instead of solve.

5 comentarios

jin wang
jin wang el 7 de Oct. de 2015
Thankyou for you answer, but as you can see from equation 5
COreq==BF1(i)+BF2(i)+BF3(i)+BF4(i);
COreq must contain the symbols because those are values that I am gonna solve using syms. Do you have any suggestions about how to solve such kind of system of coupled equations?
I can’t run your code, so I would change your solve call to:
[CO,COreq] = vpasolve([eqn1,eqn2,eqn3,eqn4,eqn5,eqn6],[CO,COreq]);
and see if that works.
Star Strider
Star Strider el 7 de Oct. de 2015
@jin wang — Thank you! Your Accepting my answer put me over 10000 Reputation points!
jin wang
jin wang el 8 de Oct. de 2015
lol. it's still not solved but thank you for the help.
Star Strider
Star Strider el 8 de Oct. de 2015
What are the approximate values for: MaxBFvsk, PctBF, MuVO2, COmax ?
What are the equations you’re starting with? It looks like some sort of metabolic or circulatory model, but I don’t recognise it. It’s fine with me if you post a PDF of the paper or references you’re working from.
Since you already Accepted my Answer, I’ll work with you as much as I can to get a solution that works, if one is possible.

Iniciar sesión para comentar.

Más respuestas (1)

John D'Errico
John D'Errico el 7 de Oct. de 2015
Editada: John D'Errico el 7 de Oct. de 2015
Look at equation 6, and then think about the error message.
eqn6 = CO==min(COmax,COreq);
Try this:
syms x y
min(x,y)
Error using sym/min (line 98)
Input arguments must be convertible to floating-point numbers.
The point is, min is invalid there in your equation. Min requires numeric arguments, not symbolic ones.

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 7 de Oct. de 2015

Comentada:

el 8 de Oct. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by