# displaying speech data in log scale using Matlab

I have speech data that I can represent using matlab plot. however, If i want to display it on log scale(like cooledit or Audition), I can take something like

data = audioread(pth);
for j=1:length(data)
if data(j) >0
data(j) = 20*log10(data(j));
else
data(j) = 20*log10(abs(data (j)));
end
end


problem with this is that zero values map to infinity and negative values map to positive side . I need representation where Y axis would run in db like [0 -3 ..-21..-inf.. -21 -3 0](like in Cooledit) and the data is plotted as per this axis.
How do i do this?
sedy

It doesn't really make sense to display an instantaneous AC waveform on a log scale - as demonstrated by your results. I googled for cooledit screenshots and found this.

To accomplish this you would want to keep your data linearly scaled and draw it normally. Then just label the axis at the desired dB points.

• It makes perfect sense and it is done in Audacity as it should be.
– jojek
Oct 16 '15 at 7:49