Mercurial > hg > ishara
annotate general/numerical/scalar/todbs.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | db7f4afd27c5 |
children |
rev | line source |
---|---|
samer@4 | 1 function Y=h_todbs(X,dBs) |
samer@4 | 2 % todbs - Convert values to decibels |
samer@4 | 3 % |
samer@4 | 4 % todbs :: |
samer@4 | 5 % real ~'dimensionless value', |
samer@4 | 6 % real ~'dynamic range in dB' |
samer@4 | 7 % -> real ~'value in dBs'. |
samer@4 | 8 |
samer@4 | 9 if nargin>1, |
samer@4 | 10 mmax=max(X(:)); |
samer@4 | 11 X=max(X,10^(-dBs/10)*mmax); |
samer@4 | 12 end |
samer@4 | 13 Y=10*log10(X); |
samer@4 | 14 |