如何在matlab中绘制曲面?
我试图在管道上做一个切口,我想做一个曲面来代表管道的外部。然而,当我绘制曲面时,我只得到曲面的对角线,而不是曲面本身。我怎样才能解决这个问题 MWE:如何在matlab中绘制曲面?,matlab,surface,Matlab,Surface,我试图在管道上做一个切口,我想做一个曲面来代表管道的外部。然而,当我绘制曲面时,我只得到曲面的对角线,而不是曲面本身。我怎样才能解决这个问题 MWE: 用surf(xx5,yy5,zz)试试surf。这就是你要找的吗 您创建的网格基于θ和半径。但是,管道外部的半径是恒定的,因此它应该基于θ和z,因为这是定义网格的两个独立变量。基于这个理由,我相信以下是你想要的 r = 0:0.1:3; z = 0:0.1:10; % set cut planes angles theta1 = 0; th
用
surf(xx5,yy5,zz)试试surf
。这就是你要找的吗
您创建的网格基于θ和半径。但是,管道外部的半径是恒定的,因此它应该基于θ和z,因为这是定义网格的两个独立变量。基于这个理由,我相信以下是你想要的
r = 0:0.1:3;
z = 0:0.1:10;
% set cut planes angles
theta1 = 0;
theta2 = pi*135/180;
nt = 101; % angle resolution
figure(1);
clf;
% create a grid over theta and z
t3 = linspace(theta1, (theta2 - 2*pi), nt);
[tt3, zz3] = meshgrid(t3, z);
% convert from cylindical to Cartesian coordinates
xx5 = r(end) * cos(tt3);
yy5 = r(end) * sin(tt3);
% plot surface
h5 = surface(xx5, yy5, zz3, 'EdgeColor', 'none');
% extra stuff to make plot prettier
axis vis3d
axis equal
view(3)
camzoom(0.7);
r = 0:0.1:3;
z = 0:0.1:10;
% set cut planes angles
theta1 = 0;
theta2 = pi*135/180;
nt = 101; % angle resolution
figure(1);
clf;
% create a grid over theta and z
t3 = linspace(theta1, (theta2 - 2*pi), nt);
[tt3, zz3] = meshgrid(t3, z);
% convert from cylindical to Cartesian coordinates
xx5 = r(end) * cos(tt3);
yy5 = r(end) * sin(tt3);
% plot surface
h5 = surface(xx5, yy5, zz3, 'EdgeColor', 'none');
% extra stuff to make plot prettier
axis vis3d
axis equal
view(3)
camzoom(0.7);