I have some recorded data s(x), and need to compute the value and uncertainty in
$$S = \int_{x_{1}}^{x_{2}} s(x) dx$$ I am using the trapezium rule for the integration, and need to estimate the uncertainty in the integral due to uncertainties in x and s(x). I have uncertainty estimates for every x and s(x) value (which are not constant). My first approach was to estimate the uncertainty in each term of the summation and add all of those uncertainties in quadrature:
$$\tag{1} S = \frac{1}{2} \sum_{i=1}^n (x_i-x_{i-1})(s_i+s_{i-1})$$
The uncertainty in $x_i-x_{i-1}$ is $$ \tag{2} \sigma_{x-x_{i}} = \sqrt{\sigma_{x_i}^2 + \sigma_{x_i-1}^2}$$
The uncertainty in $s_i+s_{i-1}$ is $$ \tag{3} \sigma_{s+s_{i}} = \sqrt{\sigma_{s_i}^2 + \sigma_{s_i-1}^2}$$
The uncertainty in the $i^{th}$ term of the sum (area of the $i^{th}$ trapezium) is therefore
$$ \tag{4} \sigma_i = \sqrt{\sigma_{x-x_{i}}^2(s_i+s_{i-1})^2 + \sigma_{s+s_{i}}^2(x_i-x_{i-1})^2}$$
And therefore the uncertainty in the integral is $$ \tag{5} \sigma = \frac{1}{2} \sqrt{\sum_{i=1}^n \sigma_i^2} $$
However, I realise that equation 5 is only valid for summing uncorrelated variables. In this case, the area of a trapezium $i$ will have some correlation with the trapeziums $i-1$ and $i+1$: if there is an error in $s_i$ then both trapeziums $i$ and $i+1$ will increase/decrease together, whereas if there is an error in $x_i$ then one will increase and one will decrease.
So, my question is, how can I estimate the uncertainty in the integral, accounting for the fact that there is a correlation between the terms in the sum?
I had thought that I might try and estimate the covariance between the terms in the sum and incorporate that, however I have run into 2 problems: Firstly, most sources only give the uncertainty propagation for sums with 2 terms, for example
$$ f = A + B, \sigma_f = \sqrt{\sigma_A^2 + \sigma_B^2 + 2\sigma_{AB}} $$
where $\sigma_{AB}$ is the covariance between A and B, so I am not sure how I would extend this to multiple terms. My guess would be that I would need something like an nxn matrix, with the covariance of every term with every other, but am not 100% sure about this.
Secondly, when looking at how I might calculate the covariance between just 2 terms, I get stuck: $$ cov(A,B) = E[(A - E[A])(B - E[B])] $$ where E[X] is the expectation value of X, however in my case I only have a single value for each term, so as far as I can see E[A]= A, and so the covariance is just 0. Also, given that I only have a single value for each term, I am not sure this approach is valid anyway.