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

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 2: Line 2:
Compute the logarithm of the argument ''x'' element by element.
Compute the logarithm of the argument ''x'' element by element.
;Usage:  
;Usage:  
:{| class="cgtable" cellpadding="3"
:{| class="einrahmen"
|-
|-
|'''<code>log(<var>x</var> , <var>b</var>)</code>''' || general logarithm to base ''b''
|<code>log(<var>x</var> , <var>b</var>)</code> || general logarithm to base ''b''
|-
|-
|'''<code>log(<var>x</var>)</code>''' || common logarithm (base 10)
|<code>log(<var>x</var>)</code> || common logarithm (base 10)
|-
|-
|'''<code>ln(<var>x</var>)</code>''' || natural logarithm (base e) || alias: <code>log(''x'','''e''')</code>
|<code>ln(<var>x</var>)</code> || natural logarithm (base e) || alias: <code>log(''x'','''e''')</code>
|-
|-
|'''<code>ld(<var>x</var>)</code>''' || logarithm to the base 2 || alias: <code>log(''x'','''2''')</code>
|<code>ld(<var>x</var>)</code> || logarithm to the base 2 || alias: <code>log(''x'','''2''')</code>
|-
|-
|}
|}
Line 16: Line 16:
:;<var>b</var>: the base of the logarithm; must be a positive number
:;<var>b</var>: 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.
;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: [[Programmer_Guide/Command_Reference/EVAL/npow2|npow2]], [[Programmer_Guide/Command_Reference/EVAL/exp|exp]], [[Programmer_Guide/Command_Reference/EVAL/log2lin|lin2log, log2lin]]
;See also: [[../npow2|npow2]], [[../exp|exp]], [[../log2lin|lin2log, log2lin]]
;Note: For the inverse function the [[Programmer_Guide/Command_Reference/EVAL#Operators|operater ''^'']] can be used; e.g.: 10^''x'', e^''x'', ...
;Note: For the inverse function use the [[..#Operators|operater ''^'']] or the function [[../exp|exp]]; e.g.: 10^''x'', e^''x'', ...
 
[[../#Functions|<function list>]]
 
 
Example:
Example:
<pre>
<pre>
Line 25: Line 29:
// $#c = { 6.02, 20, 26.02, 33.98, 40 }
// $#c = { 6.02, 20, 26.02, 33.98, 40 }
</pre>
</pre>
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]

Revision as of 11:12, 21 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 use the [[..#Operators|operater ^]] or the function exp; e.g.: 10^x, e^x, ...

<function list>


Example:

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

Navigation menu

Personal tools