I have fit a plane through three-dimensional curve made up of 18 points (18 x 3, columns are the x,y,z data). I know need to project these 18 points onto the plane. I then need to rotate this plane and points onto x-y plane with z=0.
C = planefit(Data(1,:),Data(2,:),Data(3,:)); % fit a plane the dataset
% plane parameters
x = -100:500;
y = -200:500;
[xx yy] = meshgrid(x,y);
zz = C(1)*xx+C(2)*yy + C(3) + 2*randn(size(xx));
plot3(Data(1,:),Data(2,:),Data(3,:),'b+:');
xlabel('x'); ylabel('y'); zlabel('z');
hold on;
zzft = C(1)*xx+C(2)*yy + C(3);
surf(xx,yy,zzft,'edgecolor','none') % plane
grid on
This is what I have thus far. Any help is greatly appreciated!!