summaryrefslogtreecommitdiff
path: root/macros/db2pow.sci
diff options
context:
space:
mode:
authorshamikam2017-11-07 15:59:48 +0530
committershamikam2017-11-07 15:59:48 +0530
commitc0c0582462720ed597b00e116506570577614e89 (patch)
tree31dedd23698e5357b19c810b7d7a8464100ef44a /macros/db2pow.sci
downloadFOSSEE-Signal-Processing-Toolbox-c0c0582462720ed597b00e116506570577614e89.tar.gz
FOSSEE-Signal-Processing-Toolbox-c0c0582462720ed597b00e116506570577614e89.tar.bz2
FOSSEE-Signal-Processing-Toolbox-c0c0582462720ed597b00e116506570577614e89.zip
initial commit
Diffstat (limited to 'macros/db2pow.sci')
-rw-r--r--macros/db2pow.sci29
1 files changed, 29 insertions, 0 deletions
diff --git a/macros/db2pow.sci b/macros/db2pow.sci
new file mode 100644
index 0000000..acc83d6
--- /dev/null
+++ b/macros/db2pow.sci
@@ -0,0 +1,29 @@
+function [y] = db2pow(ydb)
+
+//This function calculates the power value in Watt of the decibel value ydb passed as the parameter
+//Calling sequence
+//function [y] = mag2pow(ydb)
+//Parameters
+//ydb : scalar or vector or matrix or N-D array
+//Examples
+//ydb = 20
+//y=mag2pow(ydb)
+//Authors
+//Ishita Bedi
+//Modified to handle char i/p by Debdeep Dey
+
+funcprot(0);
+rhs = argn(2)
+if(rhs~=1)
+error("Wrong number of input arguments.")
+end
+//This statement calculates the power in Watt of ydb which was in decibel using ydb = 10log (y) -- log base 10
+if(type(ydb)~=10) then
+ y = 10.^(ydb/10);
+else
+ y1=ascii(y);
+ y = 10.^(y1/10);
+end
+
+endfunction
+