Projection of a point onto a closed convex
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Donigo Fernando Sinaga
 el 18 de Nov. de 2018
  
    
    
    
    
    Editada: Bruno Luong
      
      
 el 20 de Nov. de 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 comentarios
Respuesta aceptada
  Bruno Luong
      
      
 el 18 de Nov. de 2018
        
      Editada: Bruno Luong
      
      
 el 18 de Nov. de 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 comentarios
  Bruno Luong
      
      
 el 20 de Nov. de 2018
				
      Editada: Bruno Luong
      
      
 el 20 de Nov. de 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;
Más respuestas (0)
Ver también
Categorías
				Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

