# How to Integrate a Matlab Plot

Written by joe friedman
• Share
• Tweet
• Share
• Email

MATLAB from MathWorks is a useful computer software tool for storing, calculating and displaying data. If you have an equation to calculate data, MATLAB can easily calculate its integral, which is the same as the area under the curve if you were to plot the equation on a graph. However, if your data comes not from a closed-form equation but rather from experimental results, MATLAB uses a numerical approximation to calculate its integral - the area under the curve of its plot.

Skill level:
Moderately Easy

## Instructions

1. 1

Define a domain of x-axis values, if you don't already have one. Create a domain that ranges from one to 100 in steps of one by typing the following:

X = 1:1:100;

2. 2

Define a range of y-axis values, the experimental results, if you don't already have one. Create a random set of 100 numbers with values between zero and one by typing the following:

Y = rand(100,1);

3. 3

Calculate the area under the curve, were you to plot the data, by typing the following:

trapz(X,Y)

### Don't Miss

#### References

• All types
• Articles
• Slideshows
• Videos
##### Sort:
• Most relevant
• Most popular
• Most recent

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.