Filter löschen
Filter löschen

How to create volume out of two boundary surfaces?

2 Ansichten (letzte 30 Tage)
Teerapong Poltue
Teerapong Poltue am 21 Jun. 2021
Bearbeitet: Walter Roberson am 21 Jun. 2021
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 21 Jun. 2021
Bearbeitet: Walter Roberson am 21 Jun. 2021
[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?

Weitere Antworten (0)

Kategorien

Mehr zu Elementary Math 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!

Translated by