dB correct negative logs give complex numbers in matlab

118 views
Skip to first unread message

Stephanie Ries

unread,
Nov 15, 2014, 7:06:16 PM11/15/14
to analyzingneura...@googlegroups.com
We have a question about the decibel correction.

We tried to do a dB correct on our data but ran into a problem. When the number X in parentheses in:
dbconverted = 10*log10(X)
is negative, we get a complex number and cannot perform our following analyses.
We thought of taking the absolute value of X but that seems incorrect and gives us weird results.
I was wondering if you would have any idea of how to go about this problem. We tried looking through the book but did not find an answer.

Any help would be much appreciated!

Mike X Cohen

unread,
Nov 16, 2014, 2:47:58 AM11/16/14
to analyzingneura...@googlegroups.com
Hi Stephanie. This issue is very briefly discussed in the second sentence of the third paragraph of section 18.11 (in case you are wondering, I had to look it up -- I don't have the book memorized...). 

Indeed, the logarithm of a negative number is a complex number. The question is why you have negative numbers for power. Power values can only be positive, because they reflect the length of a vector. Perhaps you are subtracting power values before computing dB? In this case, the appropriate action would be either to divide the values before computing dB, or computing dB separately and then subtracting the dB values for two conditions. 

If you have negative power values but didn't compute a subtraction, then something must have gone wrong somewhere. If you are concerned, you can send a bit of code and I can have a look. 

Hope that helps,
Mike



--
You received this message because you are subscribed to the Google Groups "AnalyzingNeuralTimeSeriesData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzingneuraltimes...@googlegroups.com.
Visit this group at http://groups.google.com/group/analyzingneuraltimeseriesdata.
For more options, visit https://groups.google.com/d/optout.



--
Mike X Cohen, PhD
mikexcohen.com

Stephanie Ries

unread,
Nov 20, 2014, 8:57:19 PM11/20/14
to analyzingneura...@googlegroups.com
Dear Mike,

Thank you very much for your answer. So we did several things that explain why we had negative values. After calculating the power matrix, we first normalized the gamma distributed analytic signal at each freq by dividing it by its mean (so there we already got negative values). And then, after averaging the matrix to get the ERSP, we removed the baseline, again yielding negative numbers. So I guess the problem will be easily solved by just doing the dB correction without doing the normalization and baseline correction. Then, the dB correction, which already contains a form of baseline correction, should be enough and we can do our analyses from there, correct?

Thank you again for your help!

Stephanie

Mike X Cohen

unread,
Nov 21, 2014, 1:24:33 AM11/21/14
to analyzingneura...@googlegroups.com
Yes, you can use only dB. Or only mean division. There are several appropriate ways to normalize power time series, but you should use only one method rather than combining several. 

Mike


Stephanie Ries

unread,
Nov 21, 2014, 2:10:28 PM11/21/14
to analyzingneura...@googlegroups.com
Thank you!
Reply all
Reply to author
Forward
0 new messages