function position=getGraphPosition(X,YSrc,YTest)

UPPER=1;
LOWER=-1;

n=length(X);
XDev=X(2:n)-X(1:n-1);
YDev=YSrc(2:n)-YSrc(1:n-1);
XY_Tan=YDev./XDev;
I=find(abs(XY_Tan)>=1);

YDiff=YTest(I)-YSrc(I);

IUpper=find(YDiff>0);
nIUpper=length(IUpper);

ILower=find(YDiff<0);
nILower=length(ILower);

if (nIUpper>nILower)
    position=UPPER;
else
    position=LOWER;
end

