summaryrefslogtreecommitdiff
path: root/macros/db2pow.sci
blob: acc83d6f525f14d6465c4e5dbcd5b9d39ecc5a97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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