A plane can be described by
This plane has normal vector . Suppose is a given external point. Find the point in the plane which is closest to .
The equation which I derived to solve this problem is
We can implement the equation above in Matlab, recalling that prime denotes transpose in Matlab.
In your example, the plane is
and therefore and D=0. Also, in your example, the external point is .
The Matlab code to solve this is: