Projection of a point onto a closed convex
2 views (last 30 days)
Show older comments
Donigo Fernando Sinaga
on 18 Nov 2018
Edited: Bruno Luong
on 20 Nov 2018
I have a point P(50, 5000) and a curve (x.^2 - 2*x - 1) with x = [0:100]. How do I find the closest point on that curve to point P?
Thank you.
0 Comments
Accepted Answer
Bruno Luong
on 18 Nov 2018
Edited: Bruno Luong
on 18 Nov 2018
Q=[50;5000];
% Projection candidates on x.^2-2*x-y-1 = 0
P=ConicPrj(Q,[1 0; 0 0],[-2;-1],-1);
% Find the closest
[~,loc]=min(sum((P-Q).^2,1));
P=P(:,loc);
x=P(1)
y=P(2)
The projection is
x = 71.723733062992125
y = 4.999846418365362e+03
4 Comments
Bruno Luong
on 20 Nov 2018
Edited: Bruno Luong
on 20 Nov 2018
as written in the H1 line of ConicPrj , the conic is implicit equation -I change x to v here to avoid confusion with your x
E = { v such that: v'*A*v + b'*v + c = 0}
In your case, if I define v := [x;y];
the equation of parabolic is
x^2- 2*x - y -1 = 0
Meaning
x*(1)*x + x*0*y + y*0*x + y*0*y + (-2)*x + (-1)*y -1 = 0
^ ^ ^ ^ ^ ^ ^
A(1,1) A(1,2) A(2,1) A(2,2) b(1) b(2) c
or equivalently
v' * [1 0; 0 0] * v + [-2; -1]'*v - 1 = 0;
Therefore
A=[1 0; 0 0]; b = [-2; -1]; and c = -1;
More Answers (0)
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!