MATLAB : Get smoothly coloured outputs when using surf / trisurf

I had been struggling since sometime to get smoothly textured outputs using surf / trisurf commands in MATLAB. The edges of the locally planar element being used by the respective commands used to always “stand out” with respect to the texture of the contained patch.  Only today i found out a simple 1 line command that solves this problem..

tri = delaunay(X,Y);

trisurf(tri,X,Y,Z);

shading interp;                   % other options are shading face / shading faceted

And you are done.. you can check for yourself the extent to which this 1 line of code creates a change in visualization of 3d textured data.

Sample outputs, before and after :

surf output BEFORE

surf output AFTER

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s