not enough input arguments using variables from another equation system

조회 수: 3 (최근 30일)
Karen
Karen 2025년 5월 15일
댓글: Stephen23 2025년 5월 16일
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.

답변 (1개)

Matt J
Matt J 2025년 5월 16일
편집: Matt J 2025년 5월 16일
z = fsolve(@(z)TAC2(x,z) ,z2)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by