LOG10 and dB Maths Functions

Modified on 2020/03/16 09:22 by CaptainBoing — Categorized as: Electronics, Maths, Radio

Two useful math functions:

The common logarithm function. The natural logarithm of x divided by the natural logarithm of 10.

Logarithms huh?

... and the dB function to calculate the logrithmic ratio between two powers (which requires the common log function).

Both return Floats as the result

Syntax:
=LOG10(expression)

=dB(Power1,Power2)


Examples:
x=LOG10(2.88)

=dB(1,0.001)

Code:
  
	'natural log of x divided by the natural of of 10 (common Log)
	Function Log10(x As Float) As Float
		Log10=Log(x)/2.302585093
	End Function
	
	'calculate ratio between two powers as deciBels, P1 & P2 are in Watts. For dBm, specify P2=0.001
	Function dB(P1 As Float,P2 As Float) As Float
		dB=10*Log10(P1/P2)
	End Function