blob: dc1af278eec7ce0602b0b183415fa4e1542d9084 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//ydb = mag2db(y) expresses in decibels (dB) the magnitude measurements specified in y.
//The relationship between magnitude and decibels is ydb = 20 log10(y).
//Author
//Debdeep Dey
function [ydb] = mag2db(y)
funcprot(0);
ydb(find(abs(y)>0))= 20 * log10(y(find(abs(y)>0)));
ydb(find(real(y)<0))=%nan;
ydb(find(y==0))=-%inf;
ydb=matrix(ydb,size(y));
endfunction
|