Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Logarithmic axes in imagesc and contour

304 views
Skip to first unread message

Luca Zanotti Fragonara

unread,
Jun 2, 2010, 10:31:06 AM6/2/10
to
Hello, I want to plot the results of a spectrogram in a logarithmic graph (only in x).

Usually I use imagesc to plot the results of my spectrogram function (not the one ot MatLab), because contour is very slow...

In this particular application I would like to plot the results with the x axes in logarithmic scale.

I have used the following code, and it's working:

figure,contour(En,f,S);axis xy
set(gca,'XScale','log')

The same code with imagesc, doesn't work:
figure,imagesc(En,f,S);axis xy
set(gca,'XScale','log')

I don't receive any red error, but just a warning that says "Warning: Negative data ignored"

I think that is a problem with En vector. It is a vector containing the energy in my signal. It is a very little value at the beginning (smaller than 1) and big at the end (bigger than 1).
So, I need logarithm with negative indexes at the beginning: 10^-3 or so on...
Maybe with imagesc I have some trouble in this case? Is there any easy way to awoid this warning?

In fact in the second case I obtain the axes object empty (white), with the xaxis that goes from 10^0 to 10^4, instead than going from 10^-3 to 10^4.

Any suggestions?

Thank you in advance

Luca Zanotti Fragonara

unread,
Jun 3, 2010, 5:06:04 AM6/3/10
to
"Luca Zanotti Fragonara" <Luca_Z...@libero.it> wrote in message <hu5pva$b22$1...@fred.mathworks.com>...

Is it possible that is due to imagesc need integer values, or something like this?

0 new messages