yData=[3.0000 0.3548; 5.0000 0.4322; 7.0000 0.4871; 9.0000 0.5171;...
11.0000 0.5315; 13.0000 0.5346; 15.0000 0.5351; 17.0000 0.5272;...
19.0000 0.5251; 21.0000 0.5248; 23.0000 0.5189; 25.0000 0.5103;...
27.0000 0.4958; 29.0000 0.4866; 31.0000 0.4885; 33.0000 0.4680;...
35.0000 0.4599; 37.0000 0.4638; 39.0000 0.4502; 41.0000 0.4368;...
43.0000 0.4325; 45.0000 0.4107; 47.0000 0.4191; 49.0000 0.4110;...
51.0000 0.4033; 53.0000 0.3908; 55.0000 0.3907; 57.0000 0.3749;...
59.0000 0.3717; 61.0000 0.3737; 63.0000 0.3648];
options = optimoptions('fmincon','Algorithm','sqp');
[p,fval,exitflag,output,lambda] = fmincon(f,p0,A,b,Aeq,beq,lb,ub,nonlcon,options);
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
yB_Model = zeros(ndata,1);
x = fsolve(@(x)model(x, F1, p),x);
end
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
plot(yData(:,1),yData(:,2),'o',yData(:,1),yModel);
Unrecognized function or variable 'yModel'.
xlim([yData(1,1), yData(idata,1)]);
title('y_B Data v. Flowrate (1)');
xlabel('Flowrate (1) [ m^3 /s ]');
ylabel('Concentration of y_B [ kmol/m^3 ]')
midX = [min(yData(:,2)), max(yData(:,2))];
midY = [min(yData(:,2)), max(yData(:,2))];
plot(yData(:,2),yBModel, 'o', midX, midY);
xlim([min(yData(:,2)) max(yData(:,2))]);
title('Parity Plot (y_B v. y_B Data');
xlabel('Experimental y_B Data [ kmol/m^3 ]');
ylabel('Model Data y_B Data [ kmol/m^3 ]');
function f = obj(p,yData)
options = optimoptions(@fsolve, 'Display','off');
x = fsolve(@(x)model(x,F1,p),x,options);
f = norm(yData(:,2)-yModel).^2;
function h = model(x,F1,p)
r1 = (p(1)*x(1))/(x(1)*Va + x(2)*Vb + x(3)*Vc);
r2 = (p(2)*x(2))/(x(1)*Va + x(2)*Vb + x(3)*Vc);
h(1) = ((x(1)*x(4)) + (V*r1)) - Ya0*F1;
h(2) = ((x(2)*x(4)) + (V*(r2 - r1))) - Yb0*F1;
h(3) = ((x(3)*x(4)) - (V*(r2))) - Yc0*F1;
h(4) = x(1) + x(2) + x(3) - Ya0;