MATLAB Answers

## Calculating the average curve from a set of curves

Asked by Rose

### Rose (view profile)

on 31 Jul 2012

Hi, I am trying to create a pressure vs volume graph using Labview for data acquisition and importing the data to Matlab.

I was able to import the data to Matlab, but my graph looks like a sin wave that keeps oscillating. I am trying to calculate the area under the curve using the trapz function, but I would like to create a graph with only one curve representing the average of all the curves.

I thought of averaging the corresponding "y" points, but every cycle on the graph has a different amount of points so it is not possible to create a simple average program using Matlab. Also, I have used the cftool function, but it does not help me with creating just one graph. Can anyone please give some advice or any tips that can help me calculate the average curve of a set of curves?

Thank you.

Edit [01 Aug 2012, 18:15 BST - OK] Added data sample from comment

Here is a set of data:

x = [5.1373
5.1473
5.1573
5.1673
5.1773
5.1873
5.1973
5.2073]
y = [17.6690
31.3300
43.8985
51.3575
53.8226
51.1592
40.9826
22.4972
6.3214
8.8891
29.2098
47.2177
53.7129]

where x is time in seconds and y is volume.

bym

### bym (view profile)

on 31 Jul 2012

perhaps posting a small example data set would clarify your goals

Rose

### Rose (view profile)

on 1 Aug 2012

Hi, thanks for the interest. In the comment above, I put a set of data that I am using in order to learn how to compute the average of a curve using a set of curves. I graphed it on MatLAB, but I am not able to post it on the forum. The data that is posted on the comment is only volume vs. time because we do not have a good pressure transducer yet. But I still need to learn this technique because it will be helpful for the PV diagram.

Log in to comment.

## 1 Answer

### Image Analyst (view profile)

Answer by Image Analyst

### Image Analyst (view profile)

on 31 Jul 2012

If the phase of all the sine waves matched up, and you can determine a starting and ending point, then maybe you can use interp1() to get them all to have values for the same set of x values.

#### 0 Comments

Log in to comment.

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today