optimization with multivariable and constraint

조회 수: 2 (최근 30일)
Md Muzakkir Quamar
Md Muzakkir Quamar 2020년 10월 24일
편집: John D'Errico 2020년 10월 24일
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

답변 (1개)

John D'Errico
John D'Errico 2020년 10월 24일
편집: John D'Errico 2020년 10월 24일
Sorry, but this seems just plain silly. You are way overthinking things.
The new point P3 lies at the midpoint of the straight line segment connecting P1 and P2. So if
P1 = [x1,y1];
P2 = [x2,y2];
P3 = (P1 + P2)/2;
No optimization necessary. No constraints. No need to use a Mack truck to carry a pea to Boston.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by