Page 1 of 1

Subtraction of maximum value of Y in 2D data

Posted: Sun Mar 21, 2010 11:36 am
by villela
Sometimes when I have some data (X1,Y1) and I want subtract from Y1 its maximum value (Y=Y1-max(Y1)), max(Y) is not zero (indeed is very near zero). I have tried to normalize the maximum value to zero but both methods failed to get max(Y)=0 (see below):

1) Info>List Peak Values>Copy Maximum Y1 value
Edit>Operate on Y> Y1-"Maximum Y1 value"

2) Generate>Y=f(X,Y1,Y2)>Y=Y1-$YMAX(1)

How can I remove completely the residue to get max(Y)=0?

Thanks.

Posted: Sun Mar 21, 2010 12:05 pm
by DPlotAdmin
Edit>Operate on Y with Y=Y-$YMAX should do it every time but may not make the new maximum exactly equal to 0. The trouble is $YMAX in the equation is replaced by a text representation of the number (just as if you copy/pasted the value). If Ymax cannot be represented exactly by ASCII text then you won't get 0 for the new maximum. If you repeat the operation one or more times you'll get closer to 0 but may not get there with this operation until Ymax is smaller than a value that can be represented by a double-precision number (which isn't a practical solution).

If you can accept your input being truncated once sufficiently close to 0, use Operate on Y with Y=if(abs(Y)<(some arbitrarily small number),0,Y).