944,110 Members | Top Members by Rank

Ad:
Oct 28th, 2009
0

MatLab, find area under experimental data plot

Expand Post »
Hi matlab experts,

I didn't think daniweb has a matlab forum so I went over to another math forum to ask for matlab help. but i think it's either I am too stupid for the mathematicians or they are too smart to realize that it is NOT obvious what i should do from just function and math theory names thrown at me... conclusion: daniweb explains the best =)

now, since there is no official matlab forum here, I hope I can just try my luck.

Question:
I have some experimental data points plotted y against t where t = 0 to 30, 0.5 interval. I want to find area under graph from, say, t = 0.832 to 5.672

How can I do it in matlab? Please show exact step by step as far as possible, because I am a matlab noob.

So far I have seen example from trapz and quads, but the also require the function f(t) to be known, which is not possible in my case because mine is experimental data.

I expect it to be something like this (psuedocode)
f = plot(t, y)
A = integrate(f, t1, t2)
Last edited by jakesee; Oct 28th, 2009 at 12:59 pm.
Similar Threads
Reputation Points: 21
Solved Threads: 5
Junior Poster
jakesee is offline Offline
130 posts
since Jul 2008
Nov 13th, 2009
1
Re: MatLab, find area under experimental data plot
MATLAB has an "area" function, but I think it requires a known function, which doesn't help you, since your data is experimental.

I am not aware of MATLAB having the sort of function you want, unless they have added this capability recently.

You might want to check out PCHQA:

http://www.ewp.rpi.edu/hartford/~ern...S/CH04/pchqa.f

It accepts experimental data, and does a numerical integration on it, creating an interpolating spline wherever data is needed in order to give the results meaning. (If the integration used only the data points, the results would probably be meaningless, so the algorithm must interpolate at certain points in order to give the results meaning.)

However, there is one drawback: PCHQA is written in FORTRAN
Reputation Points: 33
Solved Threads: 9
Junior Poster
DavidB is offline Offline
188 posts
since Jul 2006
Nov 13th, 2009
0
Re: MatLab, find area under experimental data plot
Thanks DavidB,

Although this is actually long overdue and I had gotted my way around finally by writing some matlab code myself...

But I have to say that your reply is probably the most helpful I got. I mean seriously. Saying there is no such function for experimental data and then offering alternatives is really all I need to proceed. Thanks again.
Reputation Points: 21
Solved Threads: 5
Junior Poster
jakesee is offline Offline
130 posts
since Jul 2008
Nov 13th, 2009
2
Re: MatLab, find area under experimental data plot
Take the sum and multiply by the step size. It's that easy.

Or see Simpson's method.

Edit: Gah, of course you have to have fractional endpoints. So treat the first and last segments specially.
Last edited by Rashakil Fol; Nov 13th, 2009 at 11:24 am.
Team Colleague
Reputation Points: 1135
Solved Threads: 172
Super Senior Demiposter
Rashakil Fol is offline Offline
2,479 posts
since Jun 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: Scheme procedure to capitalize a string
Next Thread in Legacy and Other Languages Forum Timeline: print to USB from Qbasic





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC