4
$\begingroup$

How can I calculate the area under a curve after plotting discrete data as per below?

(*Plot of Power against α° with Mathematica v 8.0.0.0*)
powerdata = {{-360, 0}, {-350, 2160.018}, {-340, 3217.711}, {-330, 4238.57}, {-320, 4605.528}, {-310, 5389.598}, {-300, 5921.861}, {-290, 6520.71}, {-280, 6765.366}, {-270, 6402.162}, {-260, 5873.491}, {-250, 5100.044}, {-240, 4205.911}, {-230, 3352.66}, {-220, 2609.472}, {-210, 1926.244}, {-200, 1277.845}, {-190, 656.4205}, {-180, 0}, {-170, 695.2516}, {-160, 1439.652}, {-150, 2240.824}, {-140, 3154.999}, {-130, 4281.635}, {-120, 5719.457}, {-110, 7541.721}, {-100, 9868.855}, {-90, 12838.96}, {-80, 16579.34}, {-70, 21116.01}, {-60, 26655.91}, {-50, 33219.76}, {-40, 40198.46}, {-30, 45864.48}, {-20, 47093.57}, {-10, 41730.7}, {0, 0}, {10, 95148.07}, {20, 148445.8}, {30, 150025.8}, {40, 130629.4}, {50, 107084.8}, {60, 85503.33}, {70, 67427.1}, {80, 52707.47}, {90, 40988.6}, {100, 31697.96}, {110, 24364.54}, {120, 18551.79}, {130, 13618.07}, {140, 9413.644}, {150, 5864.437}, {160, 3208.192}, {170, 1424.567}, {180, 0}, {190, 1479.933}, {200, 2878.621}, {210, 4439.735}, {220, 6607.909}, {230, 8777.864}, {240, 10524.45}, {250, 12753.58}, {260, 15041.08}, {270, 15794.93}, {280, 16654.41}, {290, 17244.18}, {300, 16388.56}, {310, 15911.84}, {320, 13940.65}, {330, 11507.29}, {340, 8191.162}, {350, 4223.378}, {360, 0}};

(*Input data suppressed*)
dataPlot = ListPlot[powerdata, PlotRange -> {{-360, 360}, {0, 155000}}, AxesOrigin -> {-360, 0},
    PlotStyle -> PointSize[.02], PlotMarkers -> Automatic, Joined -> True,
    AxesLabel -> {Alpha, Power}, PlotLabel -> "Power versus Alpha"]

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ 10 Total[powerdata[[All, 2]]] $\endgroup$ Jan 4 '15 at 15:12
  • $\begingroup$ properly, you should only take half of the end values for the trapezoidal rule. this works because the end values are zero.. $\endgroup$
    – george2079
    Jan 4 '15 at 15:53
  • $\begingroup$ See this answer, as well as the deprecated ListIntegrate, which gives similar code for doing what ListIntegrate used to do. $\endgroup$
    – Michael E2
    Jan 4 '15 at 17:04
5
$\begingroup$
Integrate[Interpolation[powerdata][x], {x, -360, 360}]
$\endgroup$
2
  • $\begingroup$ These two answers agree to within 0.1%. $\endgroup$ Jan 4 '15 at 15:36
  • $\begingroup$ Immediately after posting this query (Jan 4 at 15:59) I added : "Since posting I did use Interpolation and Integrate and got 1.55954*10^7. Which seems reasonable. I had used -360 to 360. " Being new to this site I mistakenly posted this comment as an answer. Quite rightly, it was deleted at 18:29. Apologies to all. I shall try to be more careful in the future. $\endgroup$
    – Jim McE
    Jan 18 '15 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.