MatLab, find area under experimental data plot

Thread Solved

Join Date: Jul 2008
Posts: 95
Reputation: jakesee is an unknown quantity at this point 
Solved Threads: 4
jakesee jakesee is offline Offline
Junior Poster in Training

MatLab, find area under experimental data plot

 
0
  #1
29 Days Ago
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; 29 Days Ago at 12:59 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 88
Reputation: DavidB is an unknown quantity at this point 
Solved Threads: 2
DavidB DavidB is offline Offline
Junior Poster in Training
 
1
  #2
14 Days Ago
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 95
Reputation: jakesee is an unknown quantity at this point 
Solved Threads: 4
jakesee jakesee is offline Offline
Junior Poster in Training
 
0
  #3
14 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,039
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter
 
0
  #4
13 Days Ago
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; 13 Days Ago at 11:24 am.
All my posts may be redistributed under the GNU Free Documentation License.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC