In many engineering problems, some characteristics of data can be seen more clearly through logarithmic transformation of data. The curve of data points depicted in logarithmic coordinate system can directly represent logarithmic transformation.
There are two kinds of logarithmic transformation: double logarithmic transformation and single axis logarithmic transformation. Loglog function can be used to achieve the double log coordinate transformation, semilogx and Semilogy functions can be used to achieve the single axis log coordinate transformation.
Loglog (Y) means that the x and Y coordinates are logarithmic coordinates
Semilogx (Y) means that the x axis is a logarithmic coordinate system
Semilogy (…). That means that the Y-axis is a logarithmic coordinate system
So plotyy has two y axes, one on the left and one on the right
Example 1: Create a simple loglog with the square tag.
Solution: Enter a command
X = logspace (1, 2);
loglog(x,exp(x),’-s’)
Grid on % annotated grid
The produced figure is:
Example 2: Create a simple semi-logarithmic graph.
Solve input command:
x=0:.1:10;
semilogy(x,10.^x)
The produced figure is:
example 3: draw function graph, logarithmic graph and semilogarithmic graph of y=x^3.
Solution: Enter in the window:
x=[1:1:100];
Subplot (2,3,1);
plot(x,x.^3);
grid on;
title ‘plot-y=x^3’;
Subplot (2, 31);
loglog(x,x.^3);
grid on;
title ‘loglog-logy=3logx’;
Subplot (2 filling);
plotyy(x,x.^3,x,x);
grid on;
title ‘plotyy-y=x^3,logy=3logx’;
Subplot (2, 4);
semilogx(x,x.^3);
grid on;
title ‘semilogx-y=3logx’;
Subplot (2,3,5);
semilogy(x,x.^3);
grid on;
title ‘semilogy-logy=x^3’;
The produced figure is:
There are two kinds of logarithmic transformation: double logarithmic transformation and single axis logarithmic transformation. Loglog function can be used to achieve the double log coordinate transformation, semilogx and Semilogy functions can be used to achieve the single axis log coordinate transformation.
Loglog (Y) means that the x and Y coordinates are logarithmic coordinates
Semilogx (Y) means that the x axis is a logarithmic coordinate system
Semilogy (…). That means that the Y-axis is a logarithmic coordinate system
So plotyy has two y axes, one on the left and one on the right
Example 1: Create a simple loglog with the square tag.
Solution: Enter a command
X = logspace (1, 2);
loglog(x,exp(x),’-s’)
Grid on % annotated grid
The produced figure is:
Example 2: Create a simple semi-logarithmic graph.
Solve input command:
x=0:.1:10;
semilogy(x,10.^x)
The produced figure is:
example 3: draw function graph, logarithmic graph and semilogarithmic graph of y=x^3.
Solution: Enter in the window:
x=[1:1:100];
Subplot (2,3,1);
plot(x,x.^3);
grid on;
title ‘plot-y=x^3’;
Subplot (2, 31);
loglog(x,x.^3);
grid on;
title ‘loglog-logy=3logx’;
Subplot (2 filling);
plotyy(x,x.^3,x,x);
grid on;
title ‘plotyy-y=x^3,logy=3logx’;
Subplot (2, 4);
semilogx(x,x.^3);
grid on;
title ‘semilogx-y=3logx’;
Subplot (2,3,5);
semilogy(x,x.^3);
grid on;
title ‘semilogy-logy=x^3’;
The produced figure is:
Read More:
- Matplotlib of data visualization plt.xlim The () ylim() function sets the x-axis and y-axis range coordinates
- Origin — draw the curve with error bar
- 1 vs20152017 + OpenGL to configure and draw a white rectangle
- Python — using Matplotlib to draw histogram
- [181124] VC + + use OpenGL to draw 3D graphics example source code
- How does lightningchart, a high performance chart control, draw maps in 3D?
- RMSE(Root Mean Squared Error) & RMSLE(Root Mean Squared Logarithmic Error)
- Matlab realization of user-defined curve and legend
- The usage of Matlab function downsample
- Matlab — looking for peak function
- How to use matlab xlswrite
- How to wrap a long string in MATLAB
- What are the common clearing commands in MATLAB?
- Matlab prompt error
- How to Solve differential equations with MATLAB
- Countermeasures for Error 1935 when installing MATLAB under Windows 10
- Usage of pause function in MATLAB
- Matlab: Three forms of random number generated (Rand, Randi and Randn)
- Matlab matrix transpose function
- Matlab shows license manager error – 103