summaryrefslogtreecommitdiff
path: root/macros/mag2db.sci
diff options
context:
space:
mode:
Diffstat (limited to 'macros/mag2db.sci')
-rw-r--r--macros/mag2db.sci8
1 files changed, 4 insertions, 4 deletions
diff --git a/macros/mag2db.sci b/macros/mag2db.sci
index dc1af27..8ab0f69 100644
--- a/macros/mag2db.sci
+++ b/macros/mag2db.sci
@@ -1,11 +1,11 @@
-//ydb = mag2db(y) expresses in decibels (dB) the magnitude measurements specified in y.
+
+function [ydb] = mag2db(y)
//The relationship between magnitude and decibels is ydb = 20 log10(y).
+//ydb = mag2db(y) expresses in decibels (dB) the magnitude measurements specified in y.
//Author
//Debdeep Dey
-
-function [ydb] = mag2db(y)
-funcprot(0);
+ funcprot(0);
ydb(find(abs(y)>0))= 20 * log10(y(find(abs(y)>0)));
ydb(find(real(y)<0))=%nan;