Hi everyone, I'm trying to solve this but the message displayed local minimum found and also the values of the x generated did not match with the boundary which was set ie. x(1)+x(2) = Ym. It also says lsqnonlin stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance.Could anyone help with this? Many thanks!

clear; clc;

x0 = [50; 50; 50; 50;];

options = optimoptions('fsolve','Display','iter');

lb = [0; 0; 0; 0;];

ub = [100; 100; 100; 100;];

x = lsqnonlin(@myfun,x0,lb,ub)

myfun(x)

function F = myfun(x)

A = 87.3145;

B = -0.289762;

C = 0.0000199677;

alpha = 0.4705;

Xm = 20;

Ym = 27.5;

F = [x(1)+x(2)-Ym;

x(3)+x(4)-Xm;

A*exp(B*x(3)^0.5 - C*x(3)^3) - x(1);

A*exp(B*x(4)^0.5 - C*x(4)^3) - x(2);

Ym/alpha - ((1-alpha)/alpha)*x(2) - x(1);

Xm/alpha - ((1-alpha)/alpha)*x(4) - x(3);

]

end

## 0 Comments

Sign in to comment.