# MATLAB Truncating a surface plot in Matlab

#### ballzac

Hi,
My thesis involves several surface plots. Most of the interesting features of these plots (and also the region I am interested in) are between z=0 and z=0.2, but there are a few points that have values as high as z=4. I want to view only the region of interest, so I use

Code:
zlim([0 0.2])
This works fine in the sense that it zooms in on the region of interest, but it does not truncate parts of the plot above z=0.2. This means that the surface extends above the axes, all the way up to the top of the figure when viewed from an oblique angle. Cosmetically, I feel this is unacceptable for a thesis, and I would like the plot to be truncated at the axis limits without affecting the location of the points.

I am okay with it either 'cutting' the top off, or flattening it at the top, but would probably prefer the former. Unfortunately, changing the actual values in this region (by setting any point with a value greater that z=0.2 to 0.2) changes the actual shape of the surface between these points and the neighbouring points.

There must be simple solution for this, but I can't find one. Hopefully someone has some ideas. Thanks in advance.

Related Math Software Workshop News on Phys.org

"Truncating a surface plot in Matlab"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving