
Problem with Integrate2D

Toms
function test(Source) String Source Variable x0,x1,y0,y1 wave wSource=$Source x0=DimOffset($Source, 0) x1=(DimSize($Source, 0)-1)*DimDelta($Source,0) + DimOffset($Source,0) y0=DimOffset($Source, 1) y1=(DimSize($Source, 1)-1)*DimDelta($Source,1) + DimOffset($Source,1) print x0,x1,y0,y1 Integrate2D outerLowerLimit=x0,outerUpperLimit=x1,innerLowerLimit=y0,innerUpperLimit=y1,srcWave=wSource print V_value end
Hello,
I'm trying to do a function that gives the volume under the 2D data wave. I wrote this code even if it works for a trivial wave (like: Make/O/N=(5,9) my2DWave=pi), it doesn't work for a 2D data wave. If you have a suggestion for a solution.
Thank you
Th.P.
If you look at your printouts for x0,x1,y0,y1 they are 0,1.2,0, and 3.2. The product is 3.2*1.3*pi=12.0637 which is also the value returned by the function. The difference between your code and the example is that the example used explicit limits 0,1,0,2.
Also note that if you just pass a wave to the function and not a string you would save many '$' characters.
November 23, 2020 at 05:59 am - Permalink
Of course it works, but if I use another wave like an image for example, it doesn't work and I don't understand why
November 23, 2020 at 11:20 am - Permalink
Let me illustrate this with another example:
This should return 18 which you can verify to be the correct value for integrating f(x,y)=x*y between the limits [1,3] and [4,5]
If you are unable to determine what is going wrong with your application send it as an experiment to support@wavemetrics.com and we will take a look at it.
November 23, 2020 at 03:08 pm - Permalink