How do I interpolate and plot 3-D surfaces in MATLAB?
172 vues (au cours des 30 derniers jours)
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:
To learn about programmatic surface fit objects, 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"