# Fit Postprocessing

Plotting, outliers, residuals, confidence intervals, validation data, integrals and derivatives, generate MATLAB® code

After fitting a curve or spline, use postprocessing methods to analyze if the fit to the data is accurate. After creating a fit, you can apply various postprocessing methods for plotting, interpolation, and extrapolation; estimating confidence intervals; and calculating integrals and derivatives. You can also use postprocessing methods to determine the outliers of a fit.

You can use Curve Fitting Toolbox™ functions to evaluate a fit by plotting the residuals and the prediction bounds. For more information, see Evaluate a Curve Fit. To compare fits and generate MATLAB code interactively, use the Curve Fitting app.

## Apps

 Curve Fitting Fit curves and surfaces to data

## Functions

 `cfit` Constructor for `cfit` object `coeffnames` Coefficient names of `cfit`, `sfit`, or `fittype` object `coeffvalues` Coefficient values of `cfit` or `sfit` object `confint` Confidence intervals for fit coefficients of `cfit` or `sfit` object `differentiate` Differentiate `cfit` or `sfit` object `feval` Evaluate `cfit`, `sfit`, or `fittype` object `integrate` Integrate `cfit` object `plot` Plot `cfit` or `sfit` object `predint` Prediction intervals for `cfit` or `sfit` object `probvalues` Problem-dependent parameter values of `cfit` or `sfit` object `quad2d` Numerically integrate `sfit` object `sfit` Constructor for `sfit` object

## Topics

Create Multiple Fits in Curve Fitting App

Workflow for refining your fit, comparing multiple fits, and using statistics to determine the best fit.

Explore and Customize Plots

In Curve Fitting app, display fit, residual, surface, or contour plots; display prediction bounds and multiple plots, use zoom, pan, data cursor, and outliers modes; change axes limits and print plots.

Remove Outliers

Remove points or exclude by rule in Curve Fitting app or using the `fit` function, including excluding outliers by distance from the model, using standard deviations.

Select Validation Data

Compare your fit with validation data or test set in Curve Fitting app.

Generate Code and Export Fits to the Workspace

Generate MATLAB code from an interactive session in the Curve Fitting app, recreate fits and plots, and analyze fits in the workspace.

Evaluate a Curve Fit

This example shows how to work with a curve fit.

Evaluate a Surface Fit

This example shows how to work with a surface fit.

Evaluating Goodness of Fit

After fitting data with one or more models, evaluate the goodness of fit using plots, statistics, residuals, and confidence and prediction bounds.

Compare Fits in Curve Fitting App

Search for the best fit by creating multiple fits, comparing graphical and numerical results including fitted coefficients and goodness-of-fit statistics, and analyzing your best fit in the workspace.

Compare Fits Programmatically

This example shows how to fit and compare polynomials up to sixth degree using Curve Fitting Toolbox, fitting some census data.

Residual Analysis

The residuals from a fitted model are defined as the differences between the response data and the fit to the response data at each predictor value.

Confidence and Prediction Bounds

Curve Fitting Toolbox software lets you calculate confidence bounds for the fitted coefficients, and prediction bounds for new observations or for the fitted function.

Differentiating and Integrating a Fit

This example shows how to find the first and second derivatives of a fit, and the integral of the fit, at the predictor values.

﻿