MATLAB: Point cloud with matlab

MATLABpoint cloud

Hello Matlab,
I really want to ask regarding 3D Point cloud. we have points with X, Y, Z. We are totally new at this work. With MatLab we want to do 2D point cloud.
Any one have reference or solution etc?

Best Answer

OP's question
"I really want to ask regarding 3D Point cloud. we have points with X, Y, Z. We are totally new at this work. With MatLab we want to do 2D point cloud.
Any one have reference or solution etc?"
xyz=xlsread('PointClouds.xlsx');
r=sqrt(sum(xyz(:,1:2).^2,2));
z=xyz(:,3);
P = polyfit(z,r,5);
zi = linspace(min(z),max(z),50);
ri = polyval(P,zi);
theta = linspace(0,2*pi,100);
[THETA,Z] = meshgrid(theta,zi);
R = polyval(P,Z);
[X,Y,Z] = pol2cart(THETA,R,Z);
close all
figure();
subplot(2,1,1);
h = plot(r,z,'.b',-r,z,'.b',ri,zi,'r','linewidth',2);
axis([-80 80 -10 100])
axis equal
legend(h([1 3]),'reduction 2D','fit')
subplot(2,1,2);
surf(X,Y,Z);
axis equal