| | |
MatLab, find area under experimental data plot
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 95
Reputation:
Solved Threads: 4
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)
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.
•
•
Join Date: Jul 2006
Posts: 88
Reputation:
Solved Threads: 2
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
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
•
•
Join Date: Jul 2008
Posts: 95
Reputation:
Solved Threads: 4
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.
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.
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.
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.
![]() |
Similar Threads
- Find suitable equation for given data... (C++)
- Corelating data using MATLAB (Computer Science)
- Matlab help? (Legacy and Other Languages)
- Matlab Help Browser (Computer Science)
- refering to individual fields in separate lines (Shell Scripting)
- Need urgent help with Matlab (Legacy and Other Languages)
- finding area of something (Computer Science)
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: Scheme procedure to capitalize a string
- Next Thread: print to USB from Qbasic
| Thread Tools | Search this Thread |






