diff options
Diffstat (limited to 'macros/db2pow.sci')
-rw-r--r-- | macros/db2pow.sci | 29 |
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 + |