Programmer Guide/Command Reference/EVAL/log: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 20: Line 20:
Example:
Example:
<pre>
<pre>
#a := eval vv(1,2,3,4,5)
#a := eval 20*log(2)     // convert factor 2 to 6dB
#b := eval init(5,2,0)
#b := eval 20*log(2,10) // same as above
#c := eval vmcol($#a, $#b, $#a)  
#c := eval 20*log(fill(2,10,20,50,100))
// -> $#c is a matrix with 4 rows and 5 columns:
// $#c = { 6.02, 20, 26.02, 33.98, 40 }
//    $#c[*,*] = $#a,  #c[1,*] = $#b[*,0], $#c[2,*] = $#b[*,1], $#c[3,*] = $#a
</pre>
</pre>


[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]

Revision as of 14:56, 6 April 2011

Compute the logarithm of the argument x element by element.

Usage
log(x , b) general logarithm to base b
log(x) common logarithm (base 10)
ln(x) natural logarithm (base e) alias: log(x,e)
ld(x) logarithm to the base 2 alias: log(x,2)
x
a scalar, vector or matrix; all elements must be greater than 0
b
the base of the logarithm; must be a positive number
Result
The result r has the same type as x and contains the logarithm of x to the specified base b, computed element by element.
See also
npow2, exp, lin2log, log2lin
Note
For the inverse function the operater ^ can be used; e.g.: 10^x, e^x, ...

Example:

#a := eval 20*log(2)     // convert factor 2 to 6dB
#b := eval 20*log(2,10)  // same as above
#c := eval 20*log(fill(2,10,20,50,100))
// $#c = { 6.02, 20, 26.02, 33.98, 40 }

<function list>

Navigation menu

Personal tools