User Tools

Site Tools


platform_agnostic:maths_log10_function

LOG10 and dB Maths Functions

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:

  
	'Common Log - the natural log of x divided by the natural Log of 10
	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
platform_agnostic/maths_log10_function.txt · Last modified: 2024/01/19 09:41 by 127.0.0.1