Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If there is a exponential relationship $y = e^x$ and we take the logarithm of this we can see a linear relationship $\ln (y) = x$. So we could plot the logarithm of the y-axis values against the x values. Why does matlab do loglog plots, where the x-axis is also presented in logarithms? I see many plots where this is done.

Wouldn't using semilogy suffice? Or does using loglog or semilogy actually make no difference for a particular reason?

share|cite|improve this question
$y=c x^a \Leftrightarrow \log y = a \log x + \log c$ . – Raskolnikov Nov 1 '11 at 10:57
What @Raskolnikov's comment hints at is that loglog plots are designed to detect (approximate) power laws such as $y=cx^a$. To detect exponential laws, one would use semilog plots, as you suggest. – Did Nov 1 '11 at 11:17

Besides looking for exponential relationships, one might also want to track power law relationships. As Didier and I pointed out, log-log plots are ideal for the task because they reduce any power law relationship to a linear relationship. The exponent then becomes the slope of the graphic, as seen from

$$y=c x^a \Leftrightarrow \log y = a \log x + \log c$$

Also see this question.

share|cite|improve this answer
+1... :-) $ $ $ $ – Did Nov 1 '11 at 11:58

I ran into this old question, and I think it needs a little updating.

In communication engineering (and I would think in many other fields too) using $\operatorname{loglog}$ is very common whenever you need to plot a quantity that has a huge dynamic range in both $x$ and $y$ axes. For example, in signal processing one often computes the power spectrum of a signal. The result most likely spans many decades in frequency and many decades in amplitude. $\operatorname{loglog}$ allows you to do be able to see the result, which otherwise would be hard to interpret using any other plotting function.

I think that on a day to day basis this happens way more frequently than attempting to detect power laws. Commercial instruments that perform RF measurements are commonly setup to show both $x$ and $y$ axes in a $\operatorname{loglog}$-like fashion, for the reason I just mentioned.

See this simple example (originally from here), and try to replace loglog with plot, semilogx and semilogy. You'll see that only loglog allows you to see a meaningful plot.

Fs = 1000;
t = 0:(1/Fs):1000;
x = sin(pi*t);
[Pxx, f] = pwelch(x, [], [], [], Fs);
loglog(f, Pxx)
grid on
xlabel('Frequency (Hz)')
ylabel('Magnitude (units^2/Hz)')
title('PSD of Sine Wave')
share|cite|improve this answer
wow, you can dig up material, this answer really fits with the previous one as a nice example to try out and get a hands on understanding, thanks! – Vass Mar 3 '13 at 12:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.