Difference between plot(log(x),log(y)) and loglog(x,y)

9 visualizaciones (últimos 30 días)
Cassiers
Cassiers el 28 de Abr. de 2014
Respondida: Vasu Dev el 26 de Abr. de 2021
What's the difference between plot(log(x),log(y)) and loglog(x,y)? When should the first or second one be used?

Respuestas (4)

Star Strider
Star Strider el 28 de Abr. de 2014
Axis tick numbering. If you do plot(log(x),log(y)), the axis units will be log(x) and log(y). If you do loglog(x,y), the axis units will be x and y, with the axis ticks scaled logarithmically.
x = 1:10;
y = 1:10:100;
figure(1)
plot(log(x), log(y))
grid
figure(2)
loglog(x,y)
grid

dpb
dpb el 28 de Abr. de 2014
The difference will be on the axes -- the first is a linear plot in log(x,y) whereas the second is the log-axis plot of x,y. The shape of the two will be the same, the displayed scale values different. Easiest way to see the difference is to create a set of data and try it.
The only reason to ever use the first is for the very odd time when one would actually care about what the log() values are--not very often an occurrence I'd think; no real application comes to mind at the moment...

Walter Roberson
Walter Roberson el 28 de Abr. de 2014
With loglog(), data cursor information is in original units; with log() log(), data cursor information is in log units. Likewise for setting axis limits (which is also what controls zooming). The automatic positioning of ticks is also affected.
I seem to recall there are also effects on transparency and fill (including painting of solid faces) and on shading.

Vasu Dev
Vasu Dev el 26 de Abr. de 2021
x = 1:10;
y = 1:10:100;
figure(1)
plot(log(x), log(y))
grid
figure(2)
loglog(x,y)
grid

Categorías

Más información sobre Log Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by