Main Content

Save Custom Equations and Fit Options

In situations where you want to reapply custom equations to a data set or a different fit at a later time, you can save the custom equations along with fit options such as algorithm, tolerance and coefficient constraints in the Curve Fitter App. The saved options persist across MATLAB® sessions.

Save a Custom Equation with its Fit Options

  1. Load the census data and open the Curve Fitter app.

    load census
    curveFitter(cdate, pop)

  2. In the Curve Fitter app, on the Curve Fitter tab, in the Fit Type section, click the arrow to open the gallery. In the fit gallery, click Custom Equation in the Custom group.

  3. In the Fit Options panel, use the custom equation fit to define your own equations. An example custom equation appears when you click Custom Equation. Modify the equation as shown below. Optionally, you can modify any of the Advanced Options.

    Curve Fitter save custom equation

  4. Save the custom equation by entering a name and clicking Save. If the provided name already exists, you can either choose a different name or overwrite the previous saved equation and options.

    Curve Fitter save custom equation dialog

The custom equation is saved along with the fit options present in the current instance of the fit. The saved options will persist across MATLAB sessions and can be reapplied later.

Apply Saved Options to a Data Set

To apply an instance of saved options to a data set, you can use the Saved Options drop-down. The drop-down shows only the saved options corresponding to the active fit type i.e. curves, surfaces or linear fits.

  1. Create a new fit in the app by clicking New in the File section.

  2. In the Data section, click Select Data. In the Select Fitting Data dialog box, select cdate and pop in the X data and Y data lists, respectively.

  3. Open the Custom Equation fit type and use the Select to apply drop-down to apply myEquation to the data.

    Curve Fitter select to apply button

  4. The Curve Fitter app updates the fit.

If you modify the equation or the fit options, you can optionally resave the fit options for future use by clicking the Save button. You can save it as a new instance of saved options or overwrite the existing saved options by providing the same name i.e. myEquation.

Manage Saved Options

You can use the Manage button to rename, remove or view the saved options stored in the Curve Fitter app.

  1. Assume you have multiple custom equations saved in the app. Click the Manage button to open the Manage Saved Options dialog box.

    Curve Fitter custom equation manage button

  2. By default, the dialog opens the tab corresponding to the current fit type. In this case, it is Custom Options (Curve).

  3. You can double-click on the name to rename the saved options.

  4. Select the checkbox for one or more saved options and click on the Remove button to delete the saved options.

    Curve Fitter manage dialog

See Also

Topics