MATLAB: How to get smoother color using 3D data with colors using ‘trisurf’

boundarycolorMATLABsmoothersurfacetrisurf

I have 4D data (3D (X, Y, Z) and color (C) data) which I use to plot with 'trisurf' function. The colors obtained for the surface using the same color data is not matching with what is received using 'scatter3'. How can I get smoother color results?

Best Answer

You can use the 'boundary' function. Following steps can achieve the desired functionality:
K = boundary(X, Y, Z, 0.7);
figure;
trisurf(K,X,Y,Z,C,'EdgeColor','none')
title('Using Boundary function')
axis equal
For more information about this function, refer to the following documentation link: