Skip to content

Instantly share code, notes, and snippets.

@romanbsd
Created February 27, 2019 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romanbsd/d881da2d64b4599247296bc7e60b6579 to your computer and use it in GitHub Desktop.
Save romanbsd/d881da2d64b4599247296bc7e60b6579 to your computer and use it in GitHub Desktop.
db function for Octave
function y = db (x, SignalType)
if (nargin < 1)
print_usage ();
endif
if (nargin == 2 && SignalType == 'power')
m = 10;
else
m = 20;
endif
y = m * log10(x);
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment