Problem finding maximum of a nonlinear problem

조회 수: 4 (최근 30일)
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2022년 7월 15일
편집: Torsten 2022년 7월 15일
I have the following problem.
Minimize subject to and
I am trying to use fmincon to find this point.
My attempt as solutuion is as follows:
close all
clear
clc
fun = @(x) x(1)+x(2)+x(3); %minimize
lb = [];
ub=[];
x0 = [1 1 1];
A = [];
b=[];
Aeq=[];
beq=[];
x = fmincon(fun,x0,A,b, Aeq, beq, lb, ub, @constraints)
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.
x = 1×3
-1.4142 0.2929 -0.7071
function [c,ceq] = constraints(x)
c=[0 0];
c(1) = (x(2)-1).^2+x(3).^2-1; % <=0
c(2) = x(1).^2+(x(2)-1).^2+x(3).^2-3;
ceq = [];
end
Unfortunately, this does not work, since I get as a result
x =
1.0e+52 *
-8.2469 -0.0000 -0.0000
I know that the solution should be but I cannot see what I am doing wrong. Can someone please help me?
Best regards.
  댓글 수: 3
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2022년 7월 15일
@Torsten So, are you telling me that all the problem is that I had a typho on the statement of my problem? Anyway, thanks for the help.
Torsten
Torsten 2022년 7월 15일
편집: Torsten 2022년 7월 15일
Yes, x^3 produces negative values if x is negative. This makes your problem unbounded.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by