Hermanator
Technical User
Hello all,
I am trying to write a macro in Excel that calculates the CIE color coordinates from a given spectrum. For this I have to calculate the integral of the product of two functions:
I = INTEGRAL [ g(X)*h(X) ] dX
Both functions are in my excel sheet as 2 arrays. For instance column A contains the X-values of the data points of function g, column B are the values g(X), column C are the X-values for function h and column D contains the values h(X). To complicate things further, the datapoints for both functions do not have the same values. For instance column A would contain the points X=0,1,2,3 etc while column C contains X values X=0.5, 1.5, 2.5 etc.
If you plot both functions, than the overlap of the 2 functions would be the value that I'm looking for. However, I can't think of a way to calculate this. Is it necessary to interpolate one of the functions, so that they have common X-values?
I am trying to write a macro in Excel that calculates the CIE color coordinates from a given spectrum. For this I have to calculate the integral of the product of two functions:
I = INTEGRAL [ g(X)*h(X) ] dX
Both functions are in my excel sheet as 2 arrays. For instance column A contains the X-values of the data points of function g, column B are the values g(X), column C are the X-values for function h and column D contains the values h(X). To complicate things further, the datapoints for both functions do not have the same values. For instance column A would contain the points X=0,1,2,3 etc while column C contains X values X=0.5, 1.5, 2.5 etc.
If you plot both functions, than the overlap of the 2 functions would be the value that I'm looking for. However, I can't think of a way to calculate this. Is it necessary to interpolate one of the functions, so that they have common X-values?