Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在matlab中绘制曲面?_Matlab_Surface - Fatal编程技术网

如何在matlab中绘制曲面?

如何在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

我试图在管道上做一个切口,我想做一个曲面来代表管道的外部。然而,当我绘制曲面时,我只得到曲面的对角线,而不是曲面本身。我怎样才能解决这个问题

MWE:


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);