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

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 11: Line 11:


;See also: [[Programmer_Guide/Command_Reference/EVAL/npow2|log]], [[Programmer_Guide/Command_Reference/EVAL/exp|exp]]
;See also: [[Programmer_Guide/Command_Reference/EVAL/npow2|log]], [[Programmer_Guide/Command_Reference/EVAL/exp|exp]]
 
[[Programmer_Guide/Command_Reference/EVAL/fft|fft]], [[Programmer_Guide/Command_Reference/EVAL/cr2len|cr2len]],
Example:
Example:
<pre>
<pre>

Revision as of 15:38, 6 April 2011

Convert the elements of x to logarithmic values (e.g. dB) and vice versa.

Usage
lin2log(x {, ref {, fac}})
log2lin(x {, ref {, fac}})
x
a scalar, vector or matrix
ref
the reference value; must be a positive number (default=1)
fac
the factor; must be a positive number (default=20)
Result
The result r has the same type as x and contains the converted elements of x.
  • lin2log: ri,j = fac * log10(xi,j / ref)
  • log2lin: ri,j = ref * 10 ^ (xi,j / fac)
See also
log, exp

fft, cr2len, Example:

// #spe is a vector containing a complex spectrum
#aref := set '20e-6' // reference value: 20 micro Pascal
#logamp := eval lin2log(cr2len($#spe), $#aref) // the log. amplitude spectrum in dB

<function list>

Navigation menu

Personal tools