I would like to plot an interpolated 3d Surface between two faces, i.e. the third face of a truncated cone. my plot isn't working but I'm not sure what is wrong
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hayat
am 19 Jun. 2024
Kommentiert: Star Strider
am 20 Jun. 2024
r1=0.5;
% t1=[(0:0.1:2*pi),0];
t1=0:0.1:2*pi;
X1=r1*cos(t1);
Y1=r1*sin(t1);
n1=numel(X1);
Z1=zeros(1,n1);
DT=delaunay(X1,Y1);
trisurf(DT,X1,Y1,Z1);
hold;
r2=0.25;
% t2=[(0:0.1:2*pi),0];
t2=0:0.1:2*pi;
X2=r2*cos(t2);
Y2=r2*sin(t2);
n2=numel(X2);
Z2=200*ones(1,n2);
DT2=delaunay(X2,Y2);
trisurf(DT2,X2,Y2,Z2);
X= [X1,X2];
Y=[Y1,Y2];
Z=[Z1,Z2];
[xq,yq]=meshgrid(X,Y);
zq=ones(126).*Z;
surf(xq,yq,zq);
0 Kommentare
Akzeptierte Antwort
Star Strider
am 19 Jun. 2024
TThis does not look like a cone to me at all.
What do you want to do?
r1=0.5;
% t1=[(0:0.1:2*pi),0];
t1=0:0.1:2*pi;
X1=r1*cos(t1);
Y1=r1*sin(t1);
n1=numel(X1);
Z1=zeros(1,n1);
DT=delaunay(X1,Y1);
trisurf(DT,X1,Y1,Z1);
hold;
r2=0.25;
% t2=[(0:0.1:2*pi),0];
t2=0:0.1:2*pi;
X2=r2*cos(t2);
Y2=r2*sin(t2);
n2=numel(X2);
Z2=200*ones(1,n2);
DT2=delaunay(X2,Y2);
trisurf(DT2,X2,Y2,Z2);
X= [X1,X2];
Y=[Y1,Y2];
Z=[Z1,Z2];
[xq,yq]=meshgrid(X,Y);
zq=ones(126).*Z;
surf(xq,yq,zq);
view(-27,30)
My approach to a truncated cone (assuming my interpretation matches yours), woudl be something like this —
r = [1; 2]; % Radius Multipliers
h = [0; 3]; % Height Multipliers
a = linspace(0, 2*pi); % Angle Vector
cyl = [cos(a); sin(a)] % Circles
figure
surf(r*cyl(1,:), r*cyl(2,:), h.*[ones(size(a)); ones(size(a))], 'FaceColor','b', 'FaceAlpha',0.5) % Plot Cone
hold on
patch((r(1)*cyl(1,:)), (r(1)*cyl(2,:)), ones(size(a))*h(1), 'r') % Plot Lower Cap
patch(r(2)*cyl(1,:), r(2)*cyl(2,:), ones(size(a))*h(2), 'g') % Plot Upper Cap
hold off
grid on
axis('equal')
view(-27,30)
This is my interpretation of a truncated cone with end-caps.
.
6 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!