# How do I interpolate and plot 3-D surfaces in MATLAB?

65 vues (au cours des 30 derniers jours)
MathWorks Support Team le 10 Sep 2012
I have vectors "x", "y" and "z" representing the 3 coordinates of points on a 3-D non-linear surface. I would like to interpolate the surface and plot the results.

### Réponse acceptée

MathWorks Support Team le 14 Oct 2022
Modifié(e) : MathWorks Support Team le 14 Oct 2022
MATLAB has surface fitting capabilities in the Curve Fitting Toolbox™ that provide an easy way to interpolate and plot surfaces in MATLAB. To learn about interactive surface fitting, please see the following link:
If you have a MATLAB version prior to R2009a, please read the following for workarounds.
The function GRIDDATA can be used to interpolate and plot data in 3-D as follows:
ZI = griddata(x,y,z,XI,YI) fits a surface of the form z = f(x,y) to the data in the (usually) nonuniformly spaced vectors (x,y,z). GRIDDATA interpolates this surface at the points specified by (XI,YI) to produce ZI. The surface always passes through the data points. XI and YI usually form a uniform grid (as produced by meshgrid).
You can also fit a spline to a surface defined by the data in the same sized matrices "x", "y", and "z", where "x" and "y" are plaid (evenly-spaced) meshes. An example of using the Curve Fitting Toolbox to perform this operation is included in our online documentation starting at the following URL: "Example: Approximation by Tensor Product Splines"
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by