# MATLAB: How to create volume out of two boundary surfaces

solidsurfaces

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?

[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'})
mask = -0.4 < C & C < -0.4;C04 = C;C04(mask) = 0.4;figureisosurface(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'})figureisosurface(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'});figureisosurface(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'});
figureisosurface(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'});