clear all
close all
clc
x=1:3
y=1:5
z=1:4
[X,Y,Z]=meshgrid(x,y,z)
D = sqrt(X.^2+Y.^2+Z.^2)
max(D(:))
min(D(:))
figure
isovalue = 0.2*(max(D(:))-min(D(:)))+min(D(:))
surf1 = isosurface(X,Y,Z,D,isovalue)
p1 = patch(surf1);
isonormals(x,y,z,D,p1);
set(p1,'FaceColor','red','EdgeColor','none','FaceAlpha',0.1);
daspect([1,1,1])
view(3);
camlight; lighting gouraud
isovalue = 0.4*(max(D(:))-min(D(:)))+min(D(:))
surf2=isosurface(x,y,z,D,isovalue);
p2 = patch(surf2);
isonormals(x,y,z,D,p2);
set(p2,'FaceColor','yellow','EdgeColor','none','FaceAlpha',0.2);
isovalue = 0.6*(max(D(:))-min(D(:)))+min(D(:))
surf3=isosurface(x,y,z,D,isovalue);
p3 = patch(surf3);
isonormals(x,y,z,D,p3);
set(p3,'FaceColor','cyan','EdgeColor','none','FaceAlpha',0.3);
isovalue = 0.8*(max(D(:))-min(D(:)))+min(D(:))
surf4=isosurface(x,y,z,D,isovalue);
p4 = patch(surf4);
isonormals(x,y,z,D,p4);
set(p4,'FaceColor','blue','EdgeColor','none','FaceAlpha',1);