March 19

MATLAB Log Plot: Loglog and Everything You Need to Know

MATLAB Log Plot: Loglog and Everything You Need to Know

Abdul Mannan

Table of Contents (click for easy navigation)

  1. What is a Log Plot in MATLAB?
  2. Description
  3. Applications of Log Scale Plot
  4. Types of log plots in MATLAB
    1. loglog plot
    2. semilog plot
  5. Conclusion
  6. References

What is a Log Plot in MATLAB?

A logarithmic plot is a nonlinear scale plot utilized when there is a huge scope of amounts. The log transformation can be utilized to make exceedingly skewed distributions less skewed.


Logarithms were developed in 17th century by Scottish mathematician John Napier, the inventor of base 10 logarithms and German mathematician Nicholas Mercator the inventor of base ‘e’ also called natural logarithms.

A logarithmic scale is exponential so instead of being evenly spaced like in linear scale plots, the number get closer together as they go from 1 to 10 and also from 10 to 100 and from 100 to 1000 and so on. These blocks are known as decades since they have 10 divisions. In engineering, we typically use log scales with base 10 which means every major tick mark is equal to 10 to an exponent and that exponent increases as you proceed increasingly along the log scale.

                                                                        Fig. 1

Any base can be used for logarithm, though most common are 10, e and 2.

Applications of Log Scale Plot

Log scale plots are efficiently used in analyzing earthquakes, PH of solution and audio signals. These plots help us to see large range quantities in a small plane.

Types of log plots in MATLAB

There are two types of log plots in MATLAB:

  1. Log-log plot
  2. Semi log plot

Log-Log Plot

When we use a logarithmic plot with both axes in log scale, i.e. x-axis and y-axis both are represented in log scale, it is called log-log plot.

For example:

                                                            Fig. 2

In this figure we can see that both axes are represented in log scale hence called log-log plot.

Command used for this plot is ‘loglog’ if we want to scale both axes logarithmically. First plot a simple exponential function in MATLAB.





Fig. 3

Now use loglog(x,y) command and press enter. We see both the axes are now scaled logarithmically.

Fig. 4

Semi log plot

If we want to create a log plot with only one axis scaled logarithmically, we use the ‘semilog’ command to plot it in MATLAB.


Semilogx(x,y) command will scale x-axis logarithmically and semilogy(x,y) command will scale y-axis logarithmically as we can see in fig. 5 and fig. 6 respectively.

Fig. 5

Fig. 6

We can show the grid by using ‘grid on’ command.


grid on

                                                                                                  Fig. 7


When we deal with some quantities having a large number of ranges, we can not see the change in plot at every point. We use log plots to see that change at a scale which is divided logarithmically and it makes us easier to show all the ranges in small space. Hence the log transformation can be utilized to make exceedingly skewed distributions less skewed.



Loved this? Spread the word

About the Author

Abdul Mannan is an Electrical Power Engineer with specialization in High Voltage. He's the founder and former president at Youth Entrepreneurship Society (YES), University of Engineering & Technology Taxila Campus. He is the leading contributor at "Right to Write". Connect with him about Entrepreneurship, startup ideas, creative writing, business strategies via linked in.

Abdul Mannan

Related posts

How to Use Bill of Materials (BOM) in SolidWorks: Review Beginner’s Guide

​Read More

Compare Autodesk Inventor vs Fusion 360: Review Which One to Buy

​Read More

How to Use Convert Entities Tool in SolidWorks: Beginner Tutorial

​Read More

[May 2020] Best Free CAD Design Software for Mac

​Read More
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Subscribe to our newsletter now!