# Compute cartesian distance of two points computeCartDist=function(x1,y1,x2,y2){ return(sqrt((x2-x1)^2+(y2-y1)^2)); } # Get line equation from two of his points y=ax+b getLineEquation=function(x1,y1,x2,y2){ eq=NULL; if(x1!=x2){ a=(y1-y2)/(x1-x2) b=y1-a*x1 eq=c(a,b) } return(eq) } # Get the middle point of a segment getMiddleOfSegment=function(x1,y1,x2,y2){ x=(x1+x2)/2; y=(y1+y2)/2; return(c(x,y)); } # Convert dBm to Watt dBm2W=function(pdBm){ return((10^(pdBm/10))/1000); } # Convert Watt to dBm W2dBm=function(pW){ return(10*log10(1000*pW)); }