matlab三维圆台拟合,使用Matlab画出圆台圆锥圆柱

t=linspace(0,2*pi,n)';

xa2=R(1)*cos(t);

xa3=R(1)*sin(t);

xb2=R(2)*cos(t);

xb3=R(2)*sin(t);

% Creating the points in the X-Direction

x1=[0 length_cyl];

% Creating (Extruding) the cylinder points in the X-Directions

xx1=repmat(x1,length(xa2),1);

xx2=[xa2 xb2];%xx2=repmat(x2,1,2);

xx3=[xa3 xb3];%xx3=repmat(x3,1,2);

% Drawing two filled cirlces to close the cylinder

if closed==1

hold on

EndPlate1=fill3(xx1(:,1),xx2(:,1),xx3(:,1),'r');

EndPlate2=fill3(xx1(:,2),xx2(:,2),xx3(:,2),'r');

end

% Plotting the cylinder along the X-Direction with required length starting

% from Origin

Cone=mesh(xx1,xx2,xx3);

% Defining Unit vector along the X-direction

unit_Vx=[1 0 0];

% Calulating th

你可能感兴趣的:(matlab三维圆台拟合)