not enough input arguments using variables from another equation system

3 views (last 30 days)
Hi, Im modeling a series of cstr
clc
clear
close all
x1 = [0;0;0];
x = fsolve(@TAC1,x1)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x = 3×1
0.0688 0.0259 0.0026
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
function y = TAC1(x)
eq1 = 7*x(1)+0.437*(x(1)^0.5)*(x(2)^0.5)-5/10;
eq2 = 7*x(2)+0.437*(x(1)^0.5)*(x(2)^0.5)-2/10;
eq3 = 0.437*(x(1)^0.5)*(x(2)^0.5)-7*x(3);
y=[eq1,eq2,eq3];
end
z2 = [0;0;0];
z = fsolve(@TAC2,z2)
Not enough input arguments.

Error in solution>TAC2 (line 19)
eq4 = 7*x(1)-8*z(1)-0.437*(z(1)^0.5)*(z(2)^0.5);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in fsolve (line 167)
fuser = feval(funfcn{3},x,varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
function y = TAC2(x,z)
eq4 = 7*x(1)-8*z(1)-0.437*(z(1)^0.5)*(z(2)^0.5);
eq5 = 7*x(2)-8*z(2)-0.437*(z(1)^0.5)*(z(2)^0.5)+1/100;
eq6 = 7*x(3)-8*z(3)+0.437*(z(1)^0.5)*(z(2)^0.5);
y=[eq4,eq5,eq6];
end
this is what i have so far, i also tried to make the first 3 results as variables but that didnt work.

Answers (1)

Matt J
Matt J on 16 May 2025
Edited: Matt J on 16 May 2025
z = fsolve(@(z)TAC2(x,z) ,z2)

Community Treasure Hunt

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

Start Hunting!