The loglog command plots both x and y data sets on a log scale while the plot command plots both axes on linear scales and the semilogx/y command plots 1 axis on a linear scale and the other axis on a log scale. Other than the scale of the axes, the 3 plotting commands are identical in most ways.
Within the realm of controls, the loglog command is used to plot PSDs.
2 Basic Usage
The basic usage of the plot, semilogx/y, and loglog command are identical. Below is an example of how a PSD would be plotted
>> Fs = 1000; % Sample Rate of 1 kHz >> t = 0:(1/Fs):1000; % Time vector >> x = sin(pi*t); % Sine wave based on time vector, note pi is MATLAB defined constant >> [Pxx, f] = pwelch(x, , , , Fs); >> loglog(f, Pxx) >> grid on >> xlabel('Frequency (Hz)') >> ylabel('Magnitude (units^2/Hz)') >> title('PSD of Sine Wave')
Note that PSD is a tricky to calculate correctly. Most calculations using default arguments will produce a decent PSD but different data vectors will have different problems. Choosing the correct values for the various inputs is an art.