Calculate Area under Curve

% Calculate area under Displacement-ReactionForce Curve
% by Ning An 4, Jan, 2020
clc;
clear;
[table] = xlsread('ResultData.csv');
Displacement = table(:,1);
ReactionForce = table(:,2);
plot(Displacement, ReactionForce, 'o')
hold on
DisplacementQ = linspace(Displacement(1),Displacement(end),1000);
ReactionForceQ = interp1(Displacement,ReactionForce,DisplacementQ,'spline');
plot(DisplacementQ, ReactionForceQ, ':.')

Q1 = trapz(Displacement,ReactionForce)
Q2 = trapz(DisplacementQ,ReactionForceQ)