loglog
Plots data with logarithmic scales on both axes.
Category: Graphics > 2-D and 3-D Plots
Syntax
loglog(X, Y)
Plots Y against X with both axes logarithmic.
loglog(Y)
Plots Y against its index.
loglog(X, Y, LineSpec)
Sets color, line style and marker.
loglog(___, Name, Value)
Sets line properties.
h = loglog(___)
Also returns the line handles.
Description
A power law y = a*x^b becomes a straight line on log-log axes, with slope b, so this plot is the standard way to check for power-law behavior and to compare quantities that span several orders of magnitude. It sets the XScale and YScale of the axes to 'log'.
Input arguments
X, Y- Vectors or matrices. Values must be positive to appear on a logarithmic axis.
LineSpec- Color, line style and marker string such as
'r--o'.
Output arguments
h- Line handles.
Example
A power law
x = logspace(0, 3, 30);
loglog(x, 2*x.^1.5, 'o-')
grid on
In the app, the figure is drawn below the code.