Asked by Rose
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.

Answer by Image Analyst
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.

Log in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## bym (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/44994-calculating-the-average-curve-from-a-set-of-curves#comment_92509

perhaps posting a small example data set would clarify your goals

## Rose (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/44994-calculating-the-average-curve-from-a-set-of-curves#comment_92628

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.