not enough input arguments using variables from another equation system

3 visualizaciones (últimos 30 días)
Karen
Karen el 15 de Mayo de 2025
Comentada: Stephen23 el 16 de Mayo de 2025
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.

Respuestas (1)

Matt J
Matt J el 16 de Mayo de 2025
Editada: Matt J el 16 de Mayo de 2025
z = fsolve(@(z)TAC2(x,z) ,z2)

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by