fmincon - nonlinear equalities won't work

7 次查看(过去 30 天)
I want to find to varibles via an fmincon. I the first variable to be as low as posible, therefore i am minimizing that varible. For some reason the solution doesnt abide by the nonlinear equalities and i have no idea why. I want the sum of angles to be some value, in this examble 10. Depending on which x0 is selected, the solution will be different, however, never exactly the solution that is desired.
The nonlinear equalitie
function [c,ceq] = Model_1(x)
n = x(1);
P = x(2);
%Beam diameter (m)
D = 0.0009;
%Laser speed (mm/s)
V=150;
%Time
time= D/V;
%Thermal diffusivity (m2 s−1)
alpha= 15;
%alpha*time = αt, where α is the thermal diffusivity and t is the interaction time
at=alpha*time;
%Thermal conductivity (W m−1 K−1)
k=15;
% temperatur konstant (K)
TG= 650;
%Sheet thickness (m)
s = 0.001;
%deformation
epsilon=(0.43);
%Flow stress in the surface region (N m−2)
k_f=1422*0.54^(epsilon);
[~,T] = koltid_Mag(P,n);
N = [1:n];
for i = 1:n;
if T(i)<=1000;
E(i) = -86.095*T(i) + 200471;
else E(i) = -86.095*1000 + 200471;
end
if N(i) <= 10;
A(i) = 0.03*N(i) + 0.39;
else A(i) = 0.03*10 + 0.39;
end
%Thermal expansion coefficient (C−1)
if T(i)<=1000;
a_th(i) = 3*10^-10*T(i) + 2*10^-06;
else a_th(i) = 3*10^-10*1000 + 2*10^-06;
end
N(i)=(8*A(i)*P*((at)^(1/2)))/(pi*k*(D^2));
r_n(i)= D/(4*((at)^(1/2)));
T_ob(i)=(3/4)*N(i)*(r_n(i)'.^(2/3));
e_ob(i)=(T_ob(i)*a_th(i))-((k_f*(T_ob(i)))/(E(i)*(T_ob(i)))) ;
s_1(i)= log((4*TG*(r_n(i)^((-2)/3)))/(3*N(i)))*((2*r_n(i)*at)^(1/2))/2;
L_h(i)= r_n(i)*((4*at)^(1/2))*(-(1/(2*r_n(i)))*log((4*TG*(r_n(i)^((-2)/3)))/(3*N(i))))^(1/2);
ang(i)=-((e_ob(i)*L_h(i)*s_1(i))/(s)^2)*((3*pi*s)-(8*s_1(i)))*57.3;
end
c = [];
ceq = sum(ang) - 10;
end
  2 个评论
Walter Roberson
Walter Roberson 2021-12-2
What is your constraint violation tolerance set to?
Tobias Dehn Nielsen
I use the default constraint violation tolerance.
The exitflag says that "No feasible point was found".

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by