## Introduction to MATLAB Toolbox

In this article, we will study about toolboxes in MATLAB. The toolboxes in MTALB are a collection of numerous functions that are built on MATLAB’s computing environment.

Here are a few toolboxes in MATLAB:

- ‘Curve Fitting’
- ‘Regression learner’
- ‘Image processing’

These toolboxes can be accessed using the ‘APPS’ icon in MATLAB ribbon. Let us now understand the use of a couple of toolboxes in MATLAB:

### Curve Fitting Toolbox

- Curve fitting toolbox is used to fit the surfaces and curves to input data while using interpolation, regression, and smoothing.
- This Toolbox provides us with functions and an application to fit curves to our data.
- This toolbox is very helpful in data analytics as it helps in performing EDA (exploratory data analysis), data processing and removing outliers

Let us now understand the use of the Curve fitting toolbox using an example.

#### Example

In this example, we will use 3 metrics ‘x’, ‘y’, ‘z’ and will fit a curve in them using the Curve fitting toolbox. We will follow the following steps:

- Create the 3 matrices using rand function
- Set the ‘X Data’, ‘Y Data’, ‘Z Data’ in Curve fitting tool to our inputs, ‘x’, ‘y’, ‘z’ respectively

**Code: **(to be executed in Command Window)

`x = rand (5)`

y = rand (5)

z = rand (5)

Once we execute the above code in ‘Command Window’, we will get the 3 variables created in our ‘WORKSPACE’.

#### Steps to Use Curve Fitting toolbox

**Step 1:** Click on APPS icon

**Step 2:** Select ‘Curve Fitting Tool’

**Step 3:** A pop-up window will open like below:

**Step 4:** Now set the ‘X Data’, ‘Y Data’, ‘Z Data’ in this pop-up window to our inputs, ‘x’, ‘y’, ‘z’ respectively. We can immediately see that a curve will be created by Curve Fitting Toolbox. The equation for this curve can be seen in the Result section. We can use a custom equation using the dropdown on the top of the curve.

**Output:**

As we can see in the output, we have obtained a curve, fitting the input variables ‘x’, ‘y’, and ‘z’, which is the same as expected by us.

3 Online Courses | 1 Hands-on Project| 8+ Hours| Verifiable Certificate of Completion

4.5

View Course

Next, let us learn how Regression Learner Toolbox works in MATLAB

### Regression Learner Toolbox

- Regression Learner toolbox is used to perform regression
- It is used to train a model automatically
- It can also be used to compare different options amongst linear regression, support vector machines, regression trees & visualize the results

Let us now understand the use of the Regression Learner toolbox using an example.

#### Example

In this example, we will use an inbuilt dataset provided by MATLAB, ‘carbig’. We will upload this dataset to the ‘Regression Learner Toolbox’ and will explore the possible options. We will follow the following steps:

- Load the inbuilt dataset ‘carbig’
- Create a table using this dataset to load it into ‘Regression Learner Toolbox’

**Code: **(to be executed in Command Window)

`load carbig`

`newTable = table (Cylinders, Acceleration, Displacement,...`

Model_Year, Horsepower, Weight, Origin);

Once we execute the above code in ‘Command Window’, we will get the ‘newTable’ created in our ‘WORKSPACE’.

#### Steps to Use Regression Learner Toolbox

**Step 1:** Click on APPS icon

**Step 2: **Select ‘Regression Learner Toolbox’

**Step 3: **A pop-up window will open like below:

**Step 4: **Click on New Session in the left which will open a new window prompt

**Step 5: **From the ‘Data Set Variable’ dropdown, select the ‘newTable’ table created by us

**Step 6: **This will load all the predictor variables under the section ‘Predictors’

**Step 7: **Now we can select the predictor variables as per our requirement

**Step 8: **Click on ‘Start Session’, to start analyzing the data

We can immediately see a response plot created by Regression Learner Toolbox. Now as per our requirement, we can train this data and get a response plot, residual plot, min MSE plot using the options available.

**Output:**

Let us now understand the use of the Image processing toolbox using an example.

### Image Processing Toolbox

below we will learn about image processing toolbox:

#### Example

In this example, we will use one of the inbuilt images provided by MATLAB, ‘moon.tiff. We will upload this dataset to ‘Image processing Toolbox’ and will explore the possible options.

**Code: **(to be executed in Command Window)

`moonImage = imread ('moon.tif')`

`imtool (moonImage)`

Once we execute the above code in ‘Command Window’, we will get the ‘moonImage’ in our ‘WORKSPACE’.

#### Options Provided by Image Processing Toolbox

- Pixel Information
- Distance between the 2 pixels
- Details about the image
- Adjust contrast
- Crop Image
- Zoom tool
- Scroll bars

We can use the above options in the image processing toolbox to get detailed information about our image or do pre-processing. Basic editing can also be performed using the above options.

**Output:**

As we can see in the output, we have obtained an image of the moon that can be processed using the icons in the ribbon.

### Conclusion – MATLAB Toolbox

The toolboxes in MATLAB are a collection of numerous functions MATLAB provides various toolboxes to perform functionalities like data analytics, image processing, curve fitting, etc.

### Recommended Articles

This is a guide to MATLAB Toolbox. Here we discuss the three different toolboxes in MatLab with examples and outputs. You can also go through our other related articles to learn more –