leftimage for poohprod.ru

loglog - logarithmic plot


In this example we are going to demonstrate how to use the 'loglog' function included in Matlab to produce non-linear plots.

This term refers to the fact that the plot is logarithmically scaled in both axes. There are other functions such as 'semilogx' and 'semilogy' which have one axis in linear scale and the other axis in logarithmic scale.




1.- Create a plot using a logarithmic scale for both the x-axis and the y-axis (loglog):

clear; clc; close all

% Define your independent variable
t = 0 : 2*pi/360 : 2*pi;

% Define values along your x-axis
x = exp(t);
% Define values along your y-axis
y = 50 + exp(3*t);

% Plot your function with a wider line and grid the figure
loglog(x, y, 'LineWidth', 2)
grid

% Use a title for the figure
title('Demonstration of logarithmic plots')

% Label your x-axis with a double line.
% Note the special characters

xlabel([{'e^{t}'}; {'0 \leq t \leq 2\pi'}])

% Label your y-axis
ylabel('50 + e^{3t}')



The produced figure is:

logarithmically scaled plot, produced with the Matlab function 'loglog'


2.- Create a plot with a logarithmic scale for the x-axis and a linear scale for the y-axis (semilogx):

% clear memory data and command window
clear; clc; close all

% define your linear data
x = 0 : 1000;
% define your logarithmic function
y = log(x);

% plot your log function on linear data
semilogx(x, y)

% define values of axes and grid
axis([1 1000 0 7])
grid

% add relevant info
title('Example of Semilogx')
xlabel('x')
ylabel('y = log(x)')


The resulting figure is

log x and linear y - semilogx example

3.- Create a plot with a logarithmic scale for the y-axis and a linear scale for the x-axis (semilogy):

clear; clc; close all

% now your data along the x-axis is linear
x = 0 : 0.5 : 10;

% your function is now exponential
y = exp(x);

% see the plot
semilogy(x, y)
plot

% add info
title('Example of Semilogy')
xlabel('x')
legend('y = e^x')

The plot is


semilogarithmic plot


From 'loglog' to home

From 'loglog' to '2D Plot Menu'

Top

Table of Contents

2D summary

3D summary




footer for loglog page






















































Related pages


matlab xlswriteintegrand calculatorexponential interpolation formularc network calculatorhow to label graphs in matlabsolver matlabinfinite geometric sum formulaoctal codebinary to octal converter onlinepoisson distribution tutorialhow to create an amortization tableslope intercept form from two points calculatorvoltage in rc circuitconversion of octal to binaryscilab vs rpolynomial root finder calculatordecimal to octal conversion methodhow do you convert binary to decimalhow to label graphs in matlabonline integral calculator with boundsmatlab divisionmatlab rectanglegui handlescramer rule examplecramer's methodcombinational logic examplesconversion of octal to decimalreading resistor color bands calculatorhow to write an exponential regression equationhow to learn matlab quicklyif statements matlabquadratic formula calculator programmatlab remprogram to convert decimal to binarysalvage car price guidehow to do factorialsstrings in matlabcapacitor rc time constantscilab syntaxmatlab sindouble factorial calculatordecimal to gray code conversionmatrices multiplication examplesperiodic function definitionpythagorean triangle solvercolor band resistorswrite a program to solve quadratic equationwrite xls matlabpascals triangle programdouble factorial calculatorcalculating angles between vectorsdetermining salvage valuewhat is unit impulse functionloan repayment equationmatlab for loop exampleprograming in matlabcapacitor power factor correction calculationcoordinate conversionswap to find factorial of a numberhow to calculate depreciation rate formulapiecewise functions calculatorhow to convert binary to grey codeeir calculationcurve fitting matlab examplestring concatenation matlabformulas of simple interest and compound interestwrite a piecewise functionfactorial formulasgraphing with matlabgui tutorialsplotting curves in matlab