Fixing Contour Plot/ Smooting Contour plot

2 views (last 30 days)
Hi all,
I have data x = [-50:1:50], y = [-50:1:50] and corresponding z values for each (x,y) point. I am trying to use the data to create a contour of all data above a set z value (i.e. v = [val val]). The data set I have is perfectly symmetric about the y axis (i.e. z(x,y) = z(x,-y)) and yet when using contour(x,y,z,v) the contour plot is not symmetric. I have tried using surf on the data and using view to get a 2-d slice. This also shows these discrepancies. From reading some threads on surf it appears each pixel is surf is determined by the data in the upper left hand corner. I am assuming the problems I am having with contour stem from a similar underlying method used by the contour function. Has anyone else run into this problem or does anyone else have an idea as to how I might force contours to look the same on both sides of the y axis or a way to smooth the contours so the major differences go away? Any ideas are welcome.
Thanks in advance for the help.

Accepted Answer

Mike Garrity
Mike Garrity on 1 Sep 2015
I talked a bit about the interpolation technique that surface uses in this blog post. I'm intending to do a similar post about contour, but I haven't written it yet. The issues are similar, although there are some small differences. Both of them use simple interpolation schemes which are more focused on performance issues than on the things you're concerned about here.
The technique I showed in that blog post of using interp2 on the input to the charting function is generally the correct one to take in this situation.

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!