log10
result = log10(x)
Input: x · Output: result
What it is
Base-10 / base-2 logarithm, elementwise, same domain behavior as ln on a non-positive element. x is a scalar, Vec, or Mat/Signal.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = log10(x) | x scalar, Vec, Mat, or Signalnot documented yet | result — | Returns exactly the same type and shape as x. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
Fs = 2000
fc = 60
lp = butter(4, "low", fc, Fs)
H = freqz(lp, 512)
print(H)
mag_db = 20 * log10(abs(H))
i_fc = round(fc / (Fs / 2) * (length(H) - 1))
i_dc = 0
i_nyq = length(H) - 1
print("Gain at DC: {mag_db[i_dc]:.2f} dB")
print("Gain near cutoff ({fc} Hz): {mag_db[i_fc]:.2f} dB (expect close to -3 dB)")
print("Gain at Nyquist: {mag_db[i_nyq]:.2f} dB")
from tour
How it works
log10/log2 reuse the complex-aware ln above rather than reimplementing it -- both are pure scalar-divide compositions of it (log10(z) = ln(z)/ln(10), log2(z) = ln(z)/ln(2)).
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.
See also
log2 — documented in the same entry.