MATLAB: How to create a surface or contour plot with x, y, and z vectors


I have three vectors that represent X-Y-Z triplets. How do I produce a contour or surface plot of this data using "meshgrid" and "griddata"? 

Best Answer

In creating three-dimensional representations of data, it is often necessary to have data defined over evenly spaced, two-dimensional grids. The "surf", "mesh", "contour" and "quiver" functions are examples of graphics functions that use data in this form.
Please refer following documentation for detail example.
- MATLAB: Interpolating Scattered Data