Calculate minimum distance between point and steady but NON differentiable function

조회 수: 3 (최근 30일)
Hey,
I could not find any mathematical explanation regarding this topic on the internet and hope for your help. Is there a way to determine the minimum between a point P and a piecewise function, e.g.
syms x
A = piecewise(964<=x<=5007,((2450-10)/(5007-964))*(x-964)+10,x>5007,2450);
P = [4900;3000]
For a straight line this is normally done by finding the vertical to the envelope. But how does it look for a NON differentiable function? Is there only an iterative solution?Mode1_Outer.jpgThanks for your help!

채택된 답변

infinity
infinity 2019년 7월 12일
Hello,
There is two options that you can think
Assume we have a point P(xp, yp) and a function f(x) that we may not have derivative. Then,
1. we can define a distant between P and f by
Now, what we have to do is to find the minimum of d(x).
There are several approaches in Matlab can help you find the minimum of d.
2. We can split piecewise function into several intervals such that in each interval the function has derivative and we can find distance from P to each line and also at the intersection. Then, we can compare these solution to find the global minimum.
  댓글 수: 2
Dario Walter
Dario Walter 2019년 7월 15일
편집: Dario Walter 2019년 7월 15일
Thank you Trung.
Regarding 1. Usually you find the minimum by calculating the derivative. However, this is not possible in the present case.
2. This might work
infinity
infinity 2019년 7월 15일
Hello,
If you might want to use gradient based method to find the minimum. The method 1 should not work. However, you could use direct optimization (non - based gradient) to find the minimum of a given function without care about smooth property. For example, genetic algorihtm which you could find in matlab. For this small problem, you might use "fminbnd" in matalb.
Hope it could help you.

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

추가 답변 (0개)

카테고리

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