Graphics Reference
In-Depth Information
2.4 Logarithmic Graphics
The commands that enable MATLAB to represent graphs with logarithmic scales are the following:
loglog(X,Y) performs the same graphics as plot(X,Y) , but with logarithmic scales on the
two axes. This command presents the same variants and supports the same options as the
command plot.
semilogx(X,Y) performs the same graphics as plot(X,Y) , but with logarithmic scale on the x
axis, and normal scale on the y axis (semilogarithmic scale).
semilogy(X,Y) performs the same graphics as plot(X,Y) , but with logarithmic scale on the y
axis and normal scale on the x axis (semilogarithmic scale).
eXerCISe 2-5
present on the same graph the function y = abs (e- 1/2 x Sine(5x)) represented in normal scale, logarithmic scale
and semilogarithmic scales.
the syntax presented here leads us to Figure 2-9 , which compares the graph of the same function for the
different scales. the graph is represented in the upper part with normal and logarithmic scales and at the bottom,
the two semilogarithmic scales.
>> x = 0:0.01:3;
>> y = abs(exp(-0.5*x) .* sin(5*x));
>> subplot(2,2,1)
>> plot(x,y)
>> title('normal')
>> hold on
>> subplot(2,2,2)
>> loglog(x,y)
>> title('logarithmic')
>> subplot(2,2,3)
>> semilogx(x,y)
>> title('semilogarithmic in X axis')
>> subplot(2,2,4)
>> semilogy(x,y)
>> title('semilogarithmic in Y axis')
 
Search WWH ::




Custom Search