surface fitting
interactive surface fitting
to interactively fit a surface, follow the steps in this simple example:
load some data at the matlab® command line.
load franke
open the curve fitter app.
curvefitter
in the curve fitter app, on the curve fitter tab, in the data section, click select data. in the select fitting data dialog box, select
x
,y
, andz
as the x data, y data, and z data values, respectively.the curve fitter app creates a default interpolation fit to the data.
choose a different model type from the fit gallery in the fit type section of the curve fitter tab.
in the fit options pane, try different fit options for your chosen model type.
in the export section, click export and select generate code.
the curve fitter app creates a file in the editor containing matlab code to recreate the currently selected fit and its opened plots in your interactive session.
for more information about fitting surfaces in the curve fitter app, see interactive curve and surface fitting.
programmatic surface fitting
to programmatically fit a surface, follow the steps in this simple example:
load some data.
load franke
create a fit using the
fit
function, specifying the variables and a model type (in this casepoly23
is the model type).f = fit([x y],z,"poly23")
plot your fit and the data.
plot(f,[x y],z)
to learn what functions you can use to create and work with fits, see .