prepareSurfaceData
Prepare data inputs for surface fitting
Syntax
Description
[
如有必要,将数据转换为与xout
,YOut
,ZOut
] = prepareSurfaceData(XIn
,YIn
,ZIn
)fit
function. The function transforms data as follows:
For grid vectors, transform row (
) and column (YIn
XIn
) headers into arraysYOut
和xout
that are the same size asZIn
。Warn ifXIn
和YIn
are reversed.返回数据作为列,无论输入形状如何。如果元素数不匹配,则错误。警告元素数量是否匹配,但大小不同。
Convert complex to real (remove imaginary parts) and warn of this conversion.
Remove
NaN
或者inf
from data and warn of this removal.Convert nondouble to double and warn of this conversion.
[
transforms data including weights (xout
,YOut
,ZOut
,WOut
] = prepareSurfaceData(XIn
,YIn
,ZIn
,赢
)赢
) for surface fitting with thefit
function.
UseprepareSurfaceData
如果您的数据不在列矢量形式中。例如,您有3个矩阵。您也可以使用prepareSurfaceData
if you have grid vectors, where长度(xin)= n,长度(yin)= m
和size(ZIn) = [m,n]
。您必须处理网格向量数据以与fit
通过使用功能prepareSurfaceData
。If you use the Curve Fitter app, you can select grid vector data and it automatically converts the data for you.
If your data is in a MATLAB®表,您不需要使用prepareSurfaceData
。You can specify variables in a MATLAB table as inputs to thefit
function using the formtablename.varname
。
When you generate code from the Curve Fitter app, the generated code includes a call toprepareSurfaceData
(orprepareCurveData
for curve fits). You can call the generated file from the command line with your original data or new data as input arguments, to recreate your fits and plots. If you call the generated file with new data, theprepareCurveData
function ensures you can use any data that you can fit in the Curve Fitter app, by reshaping if necessary and removingNaN
s,inf
s, or the imaginary parts of complex numbers.