How to create volume out of two boundary surfaces?
11 次查看(过去 30 天)
显示 更早的评论
The surface is controlled by the equation '' sin(x)cos(y) + sin(y)cos(z) + sin(z)cos(x) = c ''. As we change the value of c the surface will be offseted from its original position (c = 0). And I would like to create a solid domain where -0.4 ≤ f@(x,y,z) ≤ 0.4, how can I do that?
0 个评论
采纳的回答
Walter Roberson
2021-6-21
编辑:Walter Roberson
2021-6-21
[X, Y, Z] = meshgrid(linspace(-pi, pi));
C = sin(X).*cos(Y) + sin(Y).*cos(Z) + sin(Z).*cos(X);
isosurface(X, Y, Z, C, 0.4)
xlabel('X'); ylabel('Y'); zlabel('Z');
view(3)
isosurface(X, Y, Z, C, 0.6);
isosurface(X, Y, Z, C, 0.8);
legend({'c = 0.4', 'c = 0.6', 'c = 0.8'})
I do not understand about the solid domain. Maybe...
mask = -0.4 < C & C < -0.4;
C04 = C;
C04(mask) = 0.4;
figure
isosurface(X, Y, Z, C04, 0.4)
view(3)
isosurface(X, Y, Z, C, 0.4)
xlabel('X'); ylabel('Y'); zlabel('Z');
title('c = 0.4');
legend({'background', 'c = 0.4'})
figure
isosurface(X, Y, Z, C04, 0.4);
view(3)
isosurface(X, Y, Z, C, 0.6);
xlabel('X'); ylabel('Y'); zlabel('Z');
title('c = 0.6');
legend({'background', 'c = 0.6'});
figure
isosurface(X, Y, Z, C04, 0.4)
view(3)
isosurface(X, Y, Z, C, 0.8);
xlabel('X'); ylabel('Y'); zlabel('Z');
title('c = 0.8');
legend({'background', 'c = 0.8'});
... but I don't think that is quite right.
If the idea is that the entire area that is in the range -0.4 to +0.4 should be filled in, then that is a bit tricky. MATLAB doesn't really do filled 3D solids, other than by tracing their edge.
Maybe...
figure
isosurface(X, Y, Z, C, -0.4)
view(3)
isosurface(X, Y, Z, C, 0.4)
isosurface(X, Y, Z, C, 0.8);
xlabel('X'); ylabel('Y'); zlabel('Z');
title('c = 0.8');
legend({'c = -0.4', 'c = 0.4', 'c = 0.8'});
and "understand" that between -0.4 and +0.4 is filled?
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!