How do I optimize this three variable quadratic equation to minimize one of the variables?

9 views (last 30 days)
I have a system which can be modeled by the equation
I'm trying to find the smallest value of mu for varying values of x and L such that the equation above holds true.
The values for x and L are constrained as follows:

Accepted Answer

Ameer Hamza
Ameer Hamza on 4 May 2020
Edited: Ameer Hamza on 5 May 2020
Try this
% minimize abs(mu) <=> minimize mu^2
% X(1)=x, x(2)=L, x(3)=mu
A = [-0.5 1 0];
B = 0;
x_sol = fmincon(@(X) abs(X(3)), rand(1,3), A, B, [], [], [1 0 0], [15 inf inf], @nlcon);
mu_sol = x_sol(3);
function [c, ceq] = nlcon(X)
x = X(1);
L = X(2);
mu = X(3);
ceq = (0.5 + x+2*L)*mu^2 + 0.5*mu - 2*L;
c = [];
end
The minimum value of mu turns out to be very small
mu_sol =
5.1200e-07
  6 Comments
Md Muzakkir Quamar
Md Muzakkir Quamar on 24 Oct 2020
Hi, I have a similar problem. i want to minimize a function with multi variable and constraint. i used fmin function but i think i am making some error.
here is the problem : Let P1 = (x1, y1) and P2 =
(x2, y2) be two given points. Find the third point P3 = (x3, y3) such that
d1 = d2 is minimized, where d1 is the distance from P3 to P1 and d2 is the
distance from P3 to P2.
so objective function is d1 + d2 =0 and constraint is d1=d2
where d1 = [(x3-x1)^2 +(y3-y1)^2]^1/2 & d2= [(x3-x2)^2 +(y3-y2)^2]^1/2
can you please help
BraF
BraF on 12 May 2021
Edited: BraF on 12 May 2021
Hello Ameer,
Could you tell me why in the code above, you wrote the second value of 'ub' ([15 inf inf]) as infinity ? The constraint on L is that it has to be between 0 and 0.5x, so could you explain me how to incorporate this (constraints that depend on one of the variables and that are not bounded between two scalars) ?
In my case, I have the following constraints for example :
1<x1<2 ;
x1/10<x2<3x1 ;
...
Thanks in advance!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!