Area Under Curve for 2D matrix of Peak Functions

Hi All,

I have a 2D matrix where each column is a Lorentzian curve (that I have made by extracting fit parameters from a curve fit procedure).

I want to calculate the area under the curve form y=0 for each column in the matrix. And put the result in a 1D wave.
NOTE I wanted my y intercept varied from +/-10 and I wanted to make it simple as the function only integrates from 0 and I wanted it all +ve hence the FalseDataMat which takes my original data and shifts it such that the y axis is 0.

Here's a snippit ofwhat I have so far.

Variable i
    Variable j
    for (j = 0; j < nCols; j += 1)
        for (i = 0; i < nRows; i += 1)
            FalseData[i][j]=Mat2D[i][j]-y0[j]
        endfor
        PeakArea[j]=areaXY(wnum,FalseAreaDataMat)
    endfor


I saw that the Area function only works on 1D waves. But I don't want to create a list of 1D waves...or do I have to extract.
I tried making a list of 1D waves and then killing them later but that didn't work very well.

Hopefully someone can help me!

Thanks,
N
Assuming that you have a proper xwave, replace your code with:
    for (j = 0; j < nCols; j += 1)
        MatrixOP/O/FREE colWave=col(Mat2D,j)
        PeakArea[j]=areaXY(xwave,colWave)
    endfor
Thanks Igor,

That did the trick and looks to be a very useful piece of code for me! I started reading the help topics around MatrixOp which is very useful.

Best,

N

PS what did you mean by suitable xwave? Correct dimensions?
n.black wrote:

PS what did you mean by suitable xwave? Correct dimensions?


The area calculation requires that you have an X-wave that is common for all the columns in your matrix. If you do not have such a wave then use the Integrate operation but in that case you need to apply the appropriate scaling (MatrixOP waves have default wave scaling).

A.G.
WaveMetrics, Inc.
n.black wrote:

I have a 2D matrix where each column is a Lorentzian curve (that I have made by extracting fit parameters from a curve fit procedure).

I want to calculate the area under the curve form y=0 for each column in the matrix. And put the result in a 1D wave.


Some Lorentz functions have analytical forms for their areas based on their peak parameters ...

http://magicplot.com/wiki/fit_equations

https://www.physicsforums.com/threads/area-under-the-following-curve-lo…

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville