ComputationVisualizationProgrammingFor Use with MATLAB®User’s GuideVersion 1Curve FittingToolbox
Preface viiiRelated ProductsThe Curve Fitting Toolbox requires MATLAB 6.5 (Release 13). Additionally, The MathWorks provides several related products
3 Fitting Data3-24Fitting Method and Algorithm• Method — The fitting method.The method is automatically selected based on the library or custom model
Parametric Fitting3-25• TolFun — Termination tolerance used on stopping conditions involving the function (model) value. The default value is 10-6.•To
3 Fitting Data3-26Default Coefficient ParametersThe default coefficient starting points and constraints for library and custom models are given below.
Parametric Fitting3-27Evaluating the Goodness of FitAfter fitting data with one or more models, you should evaluate the goodness of fit. A visual exam
3 Fitting Data3-28Mathematically, the residual for a specific predictor value is the difference between the response value y and the predicted respons
Parametric Fitting3-29A graphical display of the residuals for a second-degree polynomial fit is shown below. The model includes only the quadratic te
3 Fitting Data3-30For the current fit, these statistics are displayed in the Results list box in the Fit Editor. For all fits in the current curve-fit
Parametric Fitting3-31If you increase the number of fitted coefficients in your model, R-square might increase although the fit may not improve. To av
3 Fitting Data3-32Confidence and Prediction BoundsWith the Curve Fitting Toolbox, you can calculate confidence bounds for the fitted coefficients, and
Parametric Fitting3-33Calculating and Displaying Confidence Bounds. The confidence bounds for fitted coefficients are given bywhere b are the coeffici
Using This Guide ixUsing This GuideExpected BackgroundThis guide assumes that you already have background knowledge in the subject of curve fitting da
3 Fitting Data3-34The nonsimultaneous prediction bounds for a new observation at the predictor value x are given bywhere s2 is the mean squared error,
Parametric Fitting3-35To understand the quantities associated with each type of prediction interval, recall that the data, fit, and residuals (random
3 Fitting Data3-36are wider than the fitted function intervals because of the additional uncertainty in predicting a new response value (the fit plus
Parametric Fitting3-37Example: Evaluating the Goodness of FitThis example fits several polynomial models to generated data and evaluates the goodness
3 Fitting Data3-38The numerical fit results are shown below.As expected, the fit results for poly3 are reasonable because the generated data is cubic.
Parametric Fitting3-39The 95% nonsimultaneous prediction bounds for new observations are shown below. To display prediction bounds in the Curve Fittin
3 Fitting Data3-40Therefore, you would conclude that more data must be collected before you can make accurate predictions using a fifth-degree polynom
Parametric Fitting3-41Example: Rational FitThis example fits measured data using a rational model. The data describes the coefficient of thermal expan
3 Fitting Data3-42As you can see by examining the shape of the data, a reasonable initial choice for the rational model is quadratic/quadratic. The Fi
Parametric Fitting3-43The data, fit, and residuals are shown below. The fit clearly misses the data for the smallest and largest predictor values. Add
Preface xDocumentation Examples and Data SetsTo learn how to use the Curve Fitting Toolbox, you can follow the examples included in this guide. A qui
3 Fitting Data3-44For the next fit, try a cubic/cubic equation. The data, fit, and residuals are shown below.The numerical results shown below indicat
Parametric Fitting3-45Although the message in the Results window indicates that you might improve the fit if you increase the maximum number of iterat
3 Fitting Data3-46Example: Fitting with Custom EquationsYou can define your own equations with the Create Custom Equation GUI. You open this GUI one o
Parametric Fitting3-47It is sometimes useful to describe a variable expressed as a function of angle in terms of Legendre polynomialswhere Pn(x) is a
3 Fitting Data3-48The first step is to load the 12C alpha-emission data from the file carbon12alpha.mat, which is provided with the toolbox. load carb
Parametric Fitting3-49Fit the data using a fourth-degree Legendre polynomial with only even terms:Because the Legendre polynomials depend only on the
3 Fitting Data3-50The fit and residuals are shown below. The fit appears to follow the trend of the data well, while the residuals appear to be random
Parametric Fitting3-51To confirm the theoretical argument that the alpha-emission data is best described by a fourth-degree Legendre polynomial with o
3 Fitting Data3-52General Equation: Fourier Series FitThis example fits the ENSO data using several custom nonlinear equations. The ENSO data consists
Parametric Fitting3-53Note that the toolbox includes the Fourier series as a nonlinear library equation. However, the library equation does not meet t
Installation Information xiInstallation InformationTo determine if the Curve Fitting Toolbox is installed on your system, typeverat the MATLAB prompt.
3 Fitting Data3-54The fit, residuals, and numerical results are shown below. The fit appears to be reasonable for some of the data points but clearly
Parametric Fitting3-55The fit, residuals, and numerical results are shown below. The fit appears to be reasonable for most of the data points. However
3 Fitting Data3-56The fit, residuals, and numerical results are shown below. The fit is an improvement over the previous two fits, and appears to acco
Parametric Fitting3-57General Equation: Gaussian Fit with Exponential BackgroundThis example fits two poorly resolved Gaussian peaks on a decaying exp
3 Fitting Data3-58The data, fit, and numerical fit results are shown below. Clearly, the fit is poor. Because the starting points are randomly selecte
Parametric Fitting3-59The results include this warning message.Fit computation did not converge:Maximum number of function evaluations exceeded. Incre
3 Fitting Data3-60The data, fit, residuals, and numerical results are shown below.
Parametric Fitting3-61Example: Robust FitThis example fits data that is assumed to contain one outlier. The data consists of the 2000 United States pr
3 Fitting Data3-62To create a first-degree polynomial equation with zero offset, you must create a custom linear equation. As described in “Example: F
Parametric Fitting3-63The Exclude GUI is shown below. The exclusion rule is named AbsenteeVotes. You use the Fitting GUI to associate an exclusion rul
Preface xiiTypographical ConventionsThis guide uses some or all of these conventions.Item Convention ExampleExample code Monospace font To assign the
3 Fitting Data3-64The Fit Editor and the Fit Options GUI are shown below for a robust fit. The data, robust and regular least squares fits, and residu
Parametric Fitting3-65The graphical results show that the linear model is reasonable for the majority of data points, and the residuals appear to be r
3 Fitting Data3-66Again, the graphical results show that the linear model is reasonable for the majority of data points, and the residuals appear to b
Parametric Fitting3-67The margin of victory for George Bush is given bymargin = sum(bush)–sum(gore)margin = 537Therefore, the voter intention comes
3 Fitting Data3-68Nonparametric FittingIn some cases, you are not concerned about extracting or interpreting fitted parameters. Instead, you might sim
Nonparametric Fitting3-69The type of interpolant you should use depends on the characteristics of the data being fit, the required smoothness of the c
3 Fitting Data3-70Note Goodness of fit statistics, prediction bounds, and weights are not defined for interpolants. Additionally, the fit residuals a
Nonparametric Fitting3-71parameter, you can consider these fits to be parametric. However, smoothing splines are also piecewise polynomials like cubic
3 Fitting Data3-72Example: Nonparametric FitThis example fits the following data using a cubic spline interpolant and several smoothing splines.rand(&
Nonparametric Fitting3-73As shown below, you can fit the data with a smoothing spline by selecting Smoothing Spline in the Type of fit list.The level
1Getting Started with the Curve Fitting ToolboxThis chapter describes a particular example in detail to help you get started with the Curve Fitting T
3 Fitting Data3-74The data and fits are shown below. The default abscissa scale was increased to show the fit behavior beyond the data limits. You cha
Selected Bibliography3-75Selected Bibliography[1] Draper, N.R and H. Smith, Applied Regression Analysis, 3rd Ed., John Wiley & Sons, New York, 199
3 Fitting Data3-76
4Function ReferenceThis chapter describes the toolbox M-file functions that you use directly. A number of other M-file helper functions are provided
4 Function Reference4-78Functions – By CategoryFitting DataGetting Information and HelpGetting and Setting PropertiesPreprocessing Datacfit Create a c
Functions – By Category4-79Postprocessing DataGeneral Purposeconfint Compute confidence bounds for fitted coefficientsdifferentiate Differentiate a fi
4 Function Reference4-80Functions – Alphabetical ListThis section contains detailed descriptions of all toolbox functions. Each function reference pag
cfit4-814cfitPurpose Create a cfit objectSyntax fmodel = cfit(ftype,coef1,coef2,...)ArgumentsDescriptionfmodel = cfit(ftype,coef1,coef2,...) creates t
cflibhelp4-824cflibhelpPurpose Display information about library models, splines, and interpolantsSyntax cflibhelpcflibhelp groupArgumentsDescriptionc
cflibhelp4-83Example Display the names and descriptions for the spline fit type group.cflibhelp splineSPLINES SPLINETYPE DESCRIPTIO
1 Getting Started with the Curve Fitting Toolbox1-2Opening the Curve Fitting ToolThe Curve Fitting Tool is a graphical user interface (GUI) that allow
cftool4-844cftoolPurpose Open the Curve Fitting ToolSyntax cftoolcftool(xdata,ydata)ArgumentsDescriptioncftool opens the Curve Fitting Tool.cftool(xda
cftool4-85The Curve Fitting Tool is shown below. The data is from the census MAT-file, and the fit is a quadratic polynomial. The residuals are shown
cftool4-86The Data GUIThe Data GUI allows you to• Import, preview, name, and delete data sets• Smooth noisy dataThe Data GUI is shown below with the c
cftool4-87The Fitting GUIThe Fitting GUI allows you to• Fit data using a parametric or nonparametric equation• Examine and compare fit results includi
cftool4-88The Exclude GUIThe Exclude GUI allows you to create exclusion rules for a data set. An exclusion rule identifies data to be excluded while f
cftool4-89The Analysis GUIThe Analysis GUI allows you to• Evaluate (interpolate or extrapolate), differentiate, or integrate a fit• Plot the analysis
confint4-904confintPurpose Compute confidence bounds for fitted coefficientsSyntax ci = confint(fresult)ci = confint(fresult,level)ArgumentsDescriptio
confint4-91Example Fit the census data to a second-degree polynomial. The display for fresult includes the 95% confidence bounds for the fitted coeffi
datastats4-924datastatsPurpose Return descriptive statistics about the dataSyntax xds = datastats(xdata)[xds,yds] = datastats(xdata,ydata)ArgumentsDes
datastats4-93Example Return data statistics for the census data.load census[xds,yds] = datastats(cdate,pop)xds = num: 21 max: 1990
Importing the Data1-3Importing the DataBefore you can import data into the Curve Fitting Tool, the data variables must exist in the MATLAB workspace.
differentiate4-944differentiatePurpose Differentiate a fit result objectSyntax deriv1 = differentiate(fitresult,x)[deriv1,deriv2] = differentiate(...)
differentiate4-95Example Create a noisy sine wave on the interval [0, 4π].rand('state',0);x = linspace(0,4*pi,200)';y = sin(x) + (rand(
disp4-964dispPurpose Display descriptive information for Curve Fitting Toolbox objectsSyntax objdisp(obj)ArgumentsDescriptionobj or disp(obj) displays
disp4-97Note that all fit types have the Normalize, Exclude, Weights, and Method fit options. Additional fit options are available depending on the Me
excludedata4-984excludedataPurpose Specify data to be excluded from a fitSyntax outliers = excludedata(xdata,ydata,’MethodName’,MethodValue)ArgumentsD
excludedata4-99Remarks You can combine data exclusion methods using logical operators. For example, to combine methods using the | (OR) operatoroutlie
feval4-1004fevalPurpose Evaluate a fit result object or a fit type objectSyntax f = feval(fresult,x)f = feval(ftype,coef1,coef2,...,x)ArgumentsDescrip
feval4-101Create a fit result object and evaluate the object over a finer range in x.y = x.^2+(rand(size(x))-0.5);xx = (0:0.05:10)';fresult = fit
fit4-1024fitPurpose Fit data using a library or custom model, a smoothing spline, or an interpolantSyntax fresult = fit(xdata,ydata,'ltype')
fit4-103fresult = fit(xdata,ydata,'ltype','PropertyName', PropertyValue,...)fits the data using the options specified by PropertyN
1 Getting Started with the Curve Fitting Toolbox1-4To load cdate and pop into the Curve Fitting Tool, select the appropriate variable names from the X
fit4-104example, the information returned for nonlinear least squares fits is given below. Remarks For rationals and Weibull library models, the coeff
fit4-105Example Fit the census data with a second-degree polynomial library model and return the goodness of fit statistics and the output structure.l
fitoptions4-1064fitoptionsPurpose Create or modify a fit options objectSyntax opts = fitoptionsopts = fitoptions('ltype')opts = fitoptions(&
fitoptions4-107opts = fitoptions('ltype') creates a default fit options object for the library or custom fit type specified by ltype. You ca
fitoptions4-108Additional Fit OptionsIf Method is NearestInterpolant, LinearInterpolant, PchipInterpolant, or CubicSplineInterpolant, there are no add
fitoptions4-109If Method is NonlinearLeastSquares, the additional fit option properties shown below are available.Property DescriptionRobustSpecifies
fitoptions4-110Example Create an empty fit options object and configure the object so that data is normalized before fitting.opts = fitoptions;opts.No
fitoptions4-111You can return values for some fit options with the fit function. For example, fit the census data using a smoothing spline and return
fitoptions4-112The fit results are shown below.gfitgfit = General model Gauss2: gfit(x) = a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2)
fittype4-1134fittypePurpose Create a fit type objectSyntax ftype = fittype('ltype')ftype = fittype('expr')ftype = fittype('ex
Fitting the Data1-5Fitting the DataYou fit data with the Fitting GUI. You open this GUI by clicking the Fitting button on the Curve Fitting Tool. The
fittype4-114ftype = fittype('expr','PropertyName',PropertyValue,...) creates a fit type object using the specified property name/p
fittype4-115Create a fit type object for the rat33 library model. Note that the display includes the full equation.ftype = fittype('rat33')f
get4-1164getPurpose Return properties for a fit options objectSyntax get(opts)a = get(opts)a = get(opts,'PropertyName')ArgumentsDescriptiong
integrate4-1174integratePurpose Integrate a fit result objectSyntax inty = integrate(fresult,x,x0)ArgumentsDescriptioninty = integrate(fresult,x,x0) i
plot4-1184plotPurpose Plot data, fit, prediction bounds, outliers, and residualsSyntax plot(fresult)plot(fresult,xdata,ydata)plot(fresult,xdata,ydata,
plot4-119plot(fresult,'s1',xdata,ydata,'s2') plots the fit result object using the color, symbol, and line type specified by the s
plot4-120plot(...,'ptype1','ptype2',...,conflev) plots prediction bounds with the confidence level specified by conflev. conflev m
plot4-121Plot the residuals.subplot(2,1,2)plot(fit1,'k-',x,y,'b.','residuals');−8 −6 −4 −2 0 2 4 6 8−1.5−1−0.500.511.52x
plot4-122Plot 99% confidence and prediction bounds for the function and for a new observation.plot(fit1,'k-',x,y,'b.','predf&
predint4-1234predintPurpose Compute prediction bounds for new observations or for the functionSyntax ci = predint(fresult,x)ci = predint(fresult,x,lev
How to Contact The MathWorks:www.mathworks.com Webcomp.soft-sys.matlab [email protected] Technical [email protected] Product e
1 Getting Started with the Curve Fitting Toolbox1-64 Fit the additional library equations.For fits of a given type (for example, polynomials), you sho
predint4-124If simopt is off, nonsimultaneous bounds are calculated. If simopt is on, simultaneous bounds are calculated. Nonsimultaneous bounds take
predint4-125Plot the data, fit, and confidence bounds.subplot(2,2,1), plot(fresult,x,y), hold on, plot(x,c1,'k-.')legend('data',&a
set4-1264setPurpose Configure or display property values for a fit options objectSyntax set(opts)a = set(opts)set(opts,'PropertyName',Proper
set4-127Example Create a custom nonlinear model, and create a default fit options object for the model.mymodel = fittype('a*x^2+b*exp(n*c*x)&apos
smooth4-1284smoothPurpose Smooth the response dataSyntax yy = smooth(ydata)yy = smooth(ydata,span)yy = smooth(ydata,'method')yy = smooth(yda
smooth4-129are given below. For the Savitzky-Golay method, the default polynomial degree is 2.yy = smooth(ydata,span,'method') smooths data
smooth4-130Remarks For the moving average and Savitzky-Golay methods, span must be odd. If an even span is specified, it is reduced by 1. If span is g
smooth4-131The first four elements of yy are given byyy(1) = y(1)yy(2) = (y(1)+y(2)+y(3))/3yy(3) = (y(1)+y(2)+y(3)+y(4)+y(5))/5yy(4) = (y(2)+y(3)+y(4)
smooth4-132Note how the outliers have less effect with the robust method.See Also fit, sort0 5 10 15−10123Original DataSmoothed Data Using ’loess’0 5
I-1IndexNumerics6MADrobust fitting 3-12robust smoothing 2-17Aadjusted residuals 3-12adjusted R-square 3-31algorithms 3-15Analysis GUIcensus data examp
Fitting the Data1-7The data, fit, and residuals are shown below. You display the residuals as a line plot by selecting the menu item View->Residual
IndexI-2Curve Fitting ToolFourier series example 3-54Gaussian example 3-58Legendre polynomial example 3-50nonparametric fit example 3-74opening with c
IndexI-3error sum of squares 3-30evaluating the goodness of fitavailable measures 3-27example 3-37examplesevaluating the goodness of fit 3-37excluding
IndexI-4robust fit example 3-64Table of Fits 1-5fittype function 4-113flvote2k data set 3-61Fourier seriesexample 3-52fit type definition 3-16function
IndexI-5Hhahn1 data set 3-41hat matrix 3-9Iimporting data 1-3description 2-2example 2-4influential data 2-28Infsimporting 2-3removing 2-41integrate fu
IndexI-6nonlinear equationscustom 3-22fit options 3-23fitting 3-14nonlinear least squares 3-14nonparametric fittingexample 3-72methods 3-68normal dist
IndexI-7Rrationalsexample 3-41fit type definition 3-19regressionsum of squares 3-30weightsleast squares 3-9smoothing 2-14removing Infs, NaNs, and outl
IndexI-8smoothing datadefinition 2-9example 2-21local regression 2-14moving average filtering 2-12robust procedure 2-17Savitzky-Golay filtering 2-19sm
1 Getting Started with the Curve Fitting Toolbox1-8When you fit higher degree polynomials, the Results area displays this warning:Equation is badly co
Fitting the Data1-9• The fit and residuals for the single-term exponential equation indicate it is a poor fit overall. Therefore, it is a poor choice
1 Getting Started with the Curve Fitting Toolbox1-10Because the goal of fitting the census data is to extrapolate the best fit to predict future popul
Fitting the Data1-11Examining the Numerical Fit ResultsBecause you can no longer eliminate fits by examining them graphically, you should examine the
1 Getting Started with the Curve Fitting Toolbox1-12The numerical fit results are shown below. You can click the Table of Fits column headings to sort
Fitting the Data1-13To resolve this issue, examine the confidence bounds for the remaining fits. By default, 95% confidence bounds are calculated. You
1 Getting Started with the Curve Fitting Toolbox1-14The cfit object display includes the model, the fitted coefficients, and the confidence bounds for
Analyzing the Fit1-15Analyzing the FitYou can evaluate (interpolate or extrapolate), differentiate, or integrate a fit over a specified data range wit
iContentsPrefaceWhat Is the Curve Fitting Toolbox? . . . . . . . . . . . . . . . . . . . . . . viExploring the Toolbox . . . . . . . . . . . . . .
1 Getting Started with the Curve Fitting Toolbox1-16The extrapolated values and the census data set are displayed together in a new figure window.Savi
Saving Your Work1-17Saving Your WorkThe Curve Fitting Toolbox provides you with several options for saving your work. For example, as described in “Sa
1 Getting Started with the Curve Fitting Toolbox1-18Saving the SessionThe curve fitting session is defined as the current collection of fits for all d
Saving Your Work1-19Generating an M-FileYou may want to generate an M-file so that you can continue data exploration and analysis from the MATLAB comm
1 Getting Started with the Curve Fitting Toolbox1-20For example, the help for the censusfit M-file indicates that the variables cdate and pop are requ
2Importing, Viewing, and Preprocessing DataThis chapter describes how to import, view, and preprocess data with the Curve Fitting Toolbox. You import
2 Importing, Viewing, and Preprocessing Data2-2Importing Data SetsYou import data sets into the Curve Fitting Tool with the Data Sets pane of the Data
Importing Data Sets2-3Construct and Name the Data Set• Import workspace vectors — All selected variables must be the same length. You can import only
2 Importing, Viewing, and Preprocessing Data2-4Example: Importing DataThis example imports the ENSO data set into the Curve Fitting Toolbox using the
Importing Data Sets2-53 Click the Create data set button.The Data sets list box displays all the data sets added to the toolbox. Note that you can con
ii ContentsSaving Your Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17Saving the Session . . . . . . . . . . . .
2 Importing, Viewing, and Preprocessing Data2-6Viewing DataThe Curve Fitting Toolbox provides two ways to view imported data:• Graphically in a scatte
Viewing Data2-7You can change the color, line width, line style, and marker type of the displayed data points using the right-click menu shown below.
2 Importing, Viewing, and Preprocessing Data2-8Viewing Data NumericallyYou can view the numerical values of a data set, as well as data points to be e
Smoothing Data2-9Smoothing DataIf your data is noisy, you might need to apply a smoothing algorithm to expose its features, and to provide a reasonabl
2 Importing, Viewing, and Preprocessing Data2-10The Curve Fitting Toolbox supports these smoothing methods: • Moving average filtering — Lowpass filte
Smoothing Data2-11Data Sets• Original data set — Select the data set you want to smooth.•Smoothed data set — Specify the name of the smoothed data set
2 Importing, Viewing, and Preprocessing Data2-12- Click Delete to delete one or more data sets. To select multiple data sets, you can use the Ctrl key
Smoothing Data2-13Note that ys(1), ys(2), ... ,ys(end) refer to the order of the data after sorting, and not necessarily the original order.The smooth
2 Importing, Viewing, and Preprocessing Data2-14Lowess and Loess: Local Regression SmoothingThe names “lowess” and “loess” are derived from the term “
Smoothing Data2-152 A weighted linear least squares regression is performed. For lowess, the regression uses a first degree polynomial. For loess, the
iii3Fitting DataThe Fitting Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2Parametric Fitting . . . . . . . . .
2 Importing, Viewing, and Preprocessing Data2-16Using the lowess method with a span of five, the smoothed values and associated regressions for the fi
Smoothing Data2-17Robust Smoothing ProcedureIf your data contains outliers, the smoothed values can become distorted, and not reflect the behavior of
2 Importing, Viewing, and Preprocessing Data2-18The smoothing results of the lowess procedure are compared below to the results of the robust lowess p
Smoothing Data2-19Savitzky-Golay FilteringSavitzky-Golay filtering can be thought of as a generalized moving average. You derive the filter coefficien
2 Importing, Viewing, and Preprocessing Data2-20Plot (a) shows the noisy data. To more easily compare the smoothed results, plots (b) and (c) show the
Smoothing Data2-21Example: Smoothing DataThis example smooths the ENSO data set using the moving average, lowess, loess, and Savitzky-Golay methods wi
2 Importing, Viewing, and Preprocessing Data2-22The Smooth pane shown below displays all the new data sets generated by smoothing the original ENSO da
Smoothing Data2-23Use the Plotting GUI to display only the data sets of interest. As shown below, the periodic structure of the ENSO data set becomes
2 Importing, Viewing, and Preprocessing Data2-24Saving the ResultsBy clicking the Save to workspace button, you can save a smoothed data set as a stru
Excluding and Sectioning Data2-25Excluding and Sectioning DataIf there is justification, you might want to exclude part of a data set from a fit. Typi
iv Contents
2 Importing, Viewing, and Preprocessing Data2-26You mark data to be excluded from a fit with the Exclude GUI, which you open from the Curve Fitting To
Excluding and Sectioning Data2-27Exclude Individual Data Points• Select data set — Select the data set from which data points will be marked as exclud
2 Importing, Viewing, and Preprocessing Data2-28by a particular distribution, which is often assumed to be Gaussian. The statistical nature of the dat
Excluding and Sectioning Data2-29Two types of influential data points are shown below for generated data. Also shown are cubic polynomial fits and a r
2 Importing, Viewing, and Preprocessing Data2-30SectioningSectioning involves specifying a range of response data or a range of predictor data to excl
Excluding and Sectioning Data2-31Two examples of sectioning by domain are shown below for generated data.Plot (a) shows the data set sectioned by fit
2 Importing, Viewing, and Preprocessing Data2-32Example: Excluding and Sectioning DataThis example modifies the ENSO data set to illustrate excluding
Excluding and Sectioning Data2-33To mark data points for exclusion in the GUI, place the mouse cursor over the data point and left-click. The excluded
2 Importing, Viewing, and Preprocessing Data2-34The Exclude GUI for this example is shown below.To save the exclusion rule, click the Create exclusion
Excluding and Sectioning Data2-35Viewing the Exclusion RuleTo view the exclusion rule, select an existing exclusion rule name and click the View butto
PrefaceThis chapter provides an overview of the Curve Fitting Toolbox, as well as information about this documentation. The sections are as follows.W
2 Importing, Viewing, and Preprocessing Data2-36the amplitude starting point is reasonably close to the expected value, but the frequency and phase co
Excluding and Sectioning Data2-37To produce a reasonable fit, follow these steps:1 Create an exclusion rule that includes one or two periods, and excl
2 Importing, Viewing, and Preprocessing Data2-382 Create a new fit using the single-term sine equation with the exclusion rule 1Period applied.The fit
Excluding and Sectioning Data2-393 Fit the entire data set using the fitted coefficient values from the previous step as starting values.The Fitting G
2 Importing, Viewing, and Preprocessing Data2-40Additional Preprocessing StepsAdditional preprocessing steps not available through the Curve Fitting T
Additional Preprocessing Steps2-41There are several disadvantages associated with performing transformations:• For the log transformation, negative re
2 Importing, Viewing, and Preprocessing Data2-42Selected Bibliography[1] Cleveland, W.S., “Robust Locally Weighted Regression and Smoothing Scatterplo
3Fitting DataCurve fitting refers to fitting curved lines to data. The curved line comes from regression techniques, a spline calculation, or interpo
3 Fitting Data3-2The Fitting ProcessYou fit data using the Fitting GUI. To open the Fitting GUI, click the Fitting button from the Curve Fitting Tool.
The Fitting Process3-31 Select a data set and fit name.- Select the name of the current fit. When you click New fit or Copy fit, a default fit name is
Preface viWhat Is the Curve Fitting Toolbox?The Curve Fitting Toolbox is a collection of graphical user interfaces (GUIs) and M-file functions built
3 Fitting Data3-4Parametric FittingParametric fitting involves finding coefficients (parameters) for one or more models that you fit to data. The data
Parametric Fitting3-5Basic Assumptions About the ErrorWhen fitting data that contains random variations, there are two important assumptions that are
3 Fitting Data3-6The Least Squares Fitting MethodThe Curve Fitting Toolbox uses the method of least squares when fitting data. The fitting process req
Parametric Fitting3-7To solve this equation for the unknown coefficients p1 and p2, you write S as a system of n simultaneous linear equations in two
3 Fitting Data3-8Solving for b2 using the b1 valueAs you can see, estimating the coefficients p1 and p2 requires only a few simple calculations. Exten
Parametric Fitting3-9where XT is the transpose of the design matrix X. Solving for b,In MATLAB, you can use the backslash operator to solve a system o
3 Fitting Data3-10where wi are the weights. The weights determine how much each response value influences the final parameter estimates. A high-qualit
Parametric Fitting3-11The weights you supply should transform the response variances to a constant value. If you know the variances of your data, then
3 Fitting Data3-12the line get reduced weight. Points that are farther from the line than would be expected by random chance get zero weight.For most
Parametric Fitting3-134 If the fit converges, then you are done. Otherwise, perform the next iteration of the fitting procedure by returning to the fi
What Is the Curve Fitting Toolbox? viiYou can explore the graphical environment by typingcftoolClick the GUI Help buttons to learn how to proceed. Add
3 Fitting Data3-14Nonlinear Least SquaresThe Curve Fitting Toolbox uses the nonlinear least squares formulation to fit a nonlinear model to data. A no
Parametric Fitting3-153 Adjust the coefficients and determine whether the fit improves. The direction and magnitude of the adjustment depend on the fi
3 Fitting Data3-16Library ModelsThe parametric library models provided by the Curve Fitting Toolbox are described below.ExponentialsThe toolbox provid
Parametric Fitting3-17For more information about the Fourier series, refer to “Fourier Analysis and the Fast Fourier Transform” in the MATLAB document
3 Fitting Data3-18conversion for a Type J thermocouple in the 0o to 760o temperature range is described by a seventh-degree polynomial.Note If you do
Parametric Fitting3-19RationalsRational models are defined as ratios of polynomials and are given bywhere n is the degree of the numerator polynomial
3 Fitting Data3-20difference is that the sum of sines equation includes the phase constant, and does not include a DC offset term.Weibull Distribution
Parametric Fitting3-21You create custom equations with the Create Custom Equation GUI. The GUI contains two panes: a pane for creating linear equation
3 Fitting Data3-22• Equation — The custom equation.•Equation name — The name of the equation. By default, the name is automatically updated to be iden
Parametric Fitting3-23• Equation name — The name of the equation. By default, the name is automatically updated to be identical to the custom equation
Kommentare zu diesen Handbüchern