Next Post:

Use Of ‘sparse()’ Command In MatLab(Illustrated Expression)

Drawing Logarithmic 2D Graphs In MatLab(Illustrated Expression)


In MatLab, there are some special codes to convert your 2D graphs into the logarithmic curves. In this article we will explain the use of these commands to obtain logarithmic graph curves in Matlab with a very basic example below.

How To Use ‘semilogx(), semilogy() and loglog()’ Commands In MatLab?

Use of semilogx() command in Matlab.

As you see above we created a vector called as ‘t’ and created an another vector that dependent on variable ‘t’ as shown by blue arrow above. What we did is, we typed these two of variable inside the parantheses of semilogx() command as shown by green arrow. At the created graph, you can see that the curve and the x axis is exponential or logarithmic.

If we draw this graph with plot() command, curve would be linear.

The same logic is valid for semilogy() command which is for y axis again in Matlab.

Use of loglog() command in Matlab.

In this time, we used the loglog() command like simelogx() command to create a curve. At this time, curve is linear. But X and Y axes are depicted as logarithmic way as shown by blue arrows. Logarithmic calculation is done for two of axes, because of that, curve is linear on graph.

The use of semilogy(), semilogx() and loglog() exponential graph drawing commands is very easy like above. Leave your comments and questions below about semilogy(), semilogx() and loglog() commands in Matlab!

  • Site Comments

At least 10 characters required.