I have a function which is given by:
Integrating Y, Int[ I(Q)Q^2 ]dQ, actually gives the area under this curve Y (attached).
Does anyone know how to do an integrate this curve for a given range from X_min to X_max?
So you need to integrate the shown curve in a certain range? Then areaxy is what you are looking for. Or Integrate for more control.
Or do you want to integrate an analytic function? Then go for Integrate1D.
Create a duplicate of your waves from X_min to X_max using the Duplication operation or dialog.
Then in the Integrate dialog in the Analysis menu, choose these subset x and y waves.
If you want just the value of the area under the curve, use the areaxy function, which takes an xmin,xmax range.
Software Engineer, WaveMetrics, Inc.
But I followed what's shown in the command help file for the areaXY function. It's still not working.
The wave names for the Xwave and Ywave are correct (attached).
Take out the square brackets from the areaXY command so that it reads AreaXY(wave0, wave1, 43.7343, 45.3866)
AreaXY(wave0, wave1, 43.7343, 45.3866)
Square brackets in any function format indicates the parameters are optional. If you didn't include those parameters in your function i.e. just AreaXY(wave0, wave1) it will integrate over the entire wave.
I'll try again.
Still has the same problem (attached). It doesn't recognise this command somehow.
It recgonise the print area(wave1) command.
Not sure why!
The same goes for AreaXY, i.e. use print AreaXY(wave0, wave1) in the command line. The areaxy function gives back a number, with which you would have to do something (i.e. assign to a variable in a user function).
print AreaXY(wave0, wave1)
So make sure you use only commands which work in the command line, not commands which need to be in a procedure or handled otherwise. I think the wording in the help is as follows: commands called 'operation' are useable in the command line and commands called 'function' are not (see description in the help browser). So 'print' is a operation which can be executed in the command line (and will handle the result from the area function, which does not work alone).
Yes, confusing error message, isn't it? You can't invoke a built-in function without using the return value somehow. You have to use it in an expression, assign it to a variable or print it. In 6.3 we've improved the error message, as shown in the attached screen shot.
How come the area under the entire spectra is smaller than the summed area of individual peaks? (attached)
The area of the entire spectra is 467814
And that of those 6 peaks (from left to right)are as follow:
So, if 467814 subtracts the sum of those peaks, gives a negative value??
It can't be correct!
By the area of the individual peaks you mean that you fitted all these Gaussians and look at their area output, correct?
I guess then you can't compare with the overall area given by areaxy. Those fitted peaks are largely overlapping, especially in the tail region. From the information provided, it is a bit hard to tell what you want to achieve and what you have used so far. But I suppose these peaks are not fitted with the multipeakfit package (which are the way to go with this spectrum, I think). Go to Analysis -> Packages -> Multipeak Fitting to use it (there is a help provided in the menu).
I would expect it to be different. Look at the figure it seems that the fitted peaks describe only a small part of the spectrum, and e.g. much of the non-zero 'background' or 'offset' is not included in the fits. This will be included in the direct integration.
It's also hard to tell from this figure if the fitted peaks describe the data well, which would be a prerequisite.
The left endpoint of your spectrum appears to be less than zero. If you are calculating the area of the entire curve, points below zero will reduce the total area. However, from the looks of your curve, this shouldn't cause the total area to be less than the area just of the peaks.... unless the peak area is taken from y=0 rather than the baseline joining the apparent endpoints of the peaks.
As a test, I would suggest calculating areaxy for just one peak over the same limits as the fitted curve for that same peak. This may help illuminate the situation.
Did you fit the peaks individually? That is, did you use CurveFit or the Curve Fit dialog to fit little pieces of the data set? If so, the substantial overlap would mean that summing the peaks counts some of the area twice.
For overlapping peaks, I recommend the Multipeak Fit 2 package. Take a look at the demo: File->Example Experiments->Curve Fitting Multipeak Fit 2 Demo.pxp.
If you still can't figure it out, send me a copy of your Igor experiment file to firstname.lastname@example.org.
But I suppose these peaks are not fitted with the multipeakfit package (which are the way to go with this spectrum, I think).
When I fit each of these peaks, I defined a fit range in x such that the area should only be under the peak and between, say x_1, x_2.
Where x_1 and x_2 refer to the point numbers in the x wave.
And, I used the multipeakfit package.
When calculating the area under a peak, is it possible to define a baseline joining the end points of the peak and such that the area is calculated between the peak and the baseline rather than between the peak and y=0?
If not, I'd probably have to plot each peak on a separate graph and subtract its y data by the end point value in y.
Look here http://www.igorexchange.com/project/Packages/category/55 for baseline packages. They can be used to fit a baseline under your data. Remove that baseline, then redo the peak fitting and area calculations. Or, remove the baseline from the fitted curve and then calculate the area.
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
MultipeakFit2 reports the total area under a given peak from -inf to inf.
The peak functions have no vertical offset term. If the data have a baseline (like yours does) you need to include a baseline function in the fit.
I used the 'Analysis' 'Integrate...'
but it returns these messages
Shouldn't the 'Integrate...' function give the area below this curve?
No. It gives the integrated waveform. If you use differentiate you get the derivative of the waveform at each point. Integrate is the reverse.
Back to top