Documentation Center

  • Trial Software
  • Product Updates

Custom Distributions Using the Distribution Fitting App

You can use the Distribution Fitting app to fit distributions not supported by the Statistics Toolbox™ by defining a custom distribution.

Opening the Distribution Fitting App

To open the Distribution Fitting app, enter the command

dfittool

Alternatively, click Distribution Fitting on the Apps tab.

Defining Custom Distributions

To define a custom distribution, select Define Custom Distribution from the File menu. This opens a file template in the MATLAB® editor. You then edit this file so that it computes the distribution you want.

The template includes example code that computes the Laplace distribution. Follow the instructions in the template to define your own custom distribution.

To save your custom distribution, create a directory called +prob on your path. Save the file in this directory using a name that matches your distribution name. If you save the template in a folder on the MATLAB path, under its default name dfittooldists.m, the Distribution Fitting app reads it in automatically when you start the tool. You can also save the template under a different name, such as laplace.m, and then import the custom distribution as described in the following section.

Importing Custom Distributions

To import a custom distribution, select Import Custom Distributions from the File menu. This opens a dialog box in which you can select the file that defines the distribution. For example, if you created the file laplace.m, as described in the preceding section, you can enter laplace.m and select Open in the dialog box. The Distribution field of the New Fit window now contains the option Laplace.

Was this topic helpful?