www.pudn.com > lidar.rar > myplot.m, change:2010-06-19,size:890b


function myplot(x,y,z) 
% x,y and z is vector  
len=length(x); 
 
%-------------------------------------------------------------------------- 
% plot the initial data 
%-------------------------------------------------------------------------- 
figure 
plot3(x,y,z,'*r') 
 
%-------------------------------------------------------------------------- 
% plot the coarse figure 
% divide the initial vector data into matrix data. e.g. 1800*1 => 40*45 
%-------------------------------------------------------------------------- 
figure 
sqr=floor(sqrt(len)); 
for i =floor(sqr/2):sqr 
    coamod(i)=mod(len,i); 
end 
coamod(1:floor(sqr/2)-1)=1000000; 
[val,pos]=min(coamod); 
ni=pos; 
nj=floor(len/ni); 
n2=0; 
for i=1:ni 
    for j=1:nj 
        n2=n2+1; 
        xc(i,j)=x(n2); 
        yc(i,j)=y(n2); 
        zc(i,j)=z(n2); 
    end 
end 
tric=delaunay(xc,yc); 
trisurf(tric,xc,yc,zc)