MATLAB: Solving system of multiple equations

solving system of coupled 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.

Best Answer

‘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.