I have a set of N points in 3D and need to at first fit a plane to them and then find the crossed points. So I fitted a plane based on a question here (Best Fitting Plane given a Set of Points). Now I need to know how can I find the points that crossed this fitted plane? In another word, I am looking for the intersection of my dataset and plane.
x=VarName1; y=VarName2; z=VarName3; app=[y x ones(length(x),1)]; abc=inv(transpose(app)*app)*transpose(app)*z; % abc=app\z; errors= z-app*abc; residual= error*app'; [xx, yy]=meshgrid(x,y); zz=abc(1)*yy+abc(2)*xx+abc(3); surf(xx,yy,zz) hold on plot3(x,y,z) f_f=abc(3)+abc(2)*x+abc(1)*y;% plane equation
As you can see there are some crossing points. But when f_f does not have any 0 value. So I am wondering since there are some crossing points, why my equation never gets zero for different values of x and y?