How to create volume out of two boundary surfaces?

조회 수: 3 (최근 30일)
Teerapong Poltue
Teerapong Poltue 2021년 6월 21일
편집: Walter Roberson 2021년 6월 21일
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?

채택된 답변

Walter Roberson
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개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by