Hi Alessia,
I understand that you want to apply a nonlinear constraint to your optimization problem in MATLAB using fmincon, where the thrust can either be zero or the maximum possible value (Tmax). Here's how you can define this constraint:
function [c, ceq] = thrustConstraint(x)
Tmax = ...; % Define your Tmax value here
Tr = x(1); % Radial thrust
Tt = x(2); % Tangential thrust
Tn = x(3); % Normal thrust
thrust = sqrt(Tr^2 + Tt^2 + Tn^2);
% Nonlinear equality constraints
ceq = [thrust; thrust - Tmax];
% No inequality constraints
c = [];
end
When using fmincon, specify this function as the nonlinear constraint function.
Hope this helps.
Regards,
Nipun