フィルターのクリア

Hi, i drew 4 cylinders, while removing a part from each and sticking them together. However, the cylinders are hollow and i want to at least have a bottom and top lid (same shape as the cylinders) if not fully fill it in 3D. Any help would be nice.

2 ビュー (過去 30 日間)
Omar Rashed
Omar Rashed 2016 年 10 月 6 日
コメント済み: KSSV 2016 年 10 月 10 日
h=figure(1);
set(h, 'WindowStyle', 'docked')
drawnow
for i=0:1.5:6
[x,y,z]= cylinder(1,1000);
z(:,386:617)=NaN;
x(:,386:617)=NaN;
y(:,386:617)=NaN;
h=surf(x+i,y,z, 'FaceColor', [0,0,1]);
hold on
end

回答 (1 件)

KSSV
KSSV 2016 年 10 月 7 日
clc; clear all ;
h=figure(1);
set(h, 'WindowStyle', 'docked')
th = linspace(0,2*pi) ;
R = 1 ;
for i=0:1.5:6
[x,y,z]= cylinder(1,100);
% draw circle
% z(:,386:617)=NaN;
% x(:,386:617)=NaN;
% y(:,386:617)=NaN;
% draw circle
xc = i+R*cos(th) ; yc = R*sin(th) ;
% top cirlce z
zc1 = ones(size(xc)) ;
% bottom cricle
zc0 = zeros(size(xc)) ;
h=surf(x+i,y,z, 'FaceColor', [0,0,1]);
hold on
patch(xc,yc,zc0,'r')
patch(xc,yc,zc1,'r')
end
  2 件のコメント
Omar Rashed
Omar Rashed 2016 年 10 月 7 日
But the circles overlapped, how can you prevent the overlap?
KSSV
KSSV 2016 年 10 月 10 日
YOur cylinders also overlapped......

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by