MATLAB: Area under curve (no function)

numerical integration

Hello,
If I have a set of data such as
X = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.85];
rA = [-.0053, -.0052, -.0050, -.0045, -.0040, -.0033, -.0025, -.0018, -.00125, -.0010];
plot(X,-1./rA)
and I want to know the area under the curve generated in the graph, how would I do that? There is no function involved here, this is just raw data, so I know I can't use quad or any of those integral functions.
Thanks

Best Answer

Use trapz. It’s designed to do exactly what you want.
Int = trapz(X, -1./rA)
produces:
Int =
306.7455