Note that this page is a copy of the ControlTheoryPro.com page on semilogx/y commands.
The semilogx or semilogy commands plot data with 1 axis linear and the other axis log scale. The semilogx command plots the data on the x-axis on a log scale. For controls this is particularly useful when manually creating a bode plot.
The MATLAB bode plot is very convenient but when the plot needs to be formatted then the bode command makes this difficult. As a result this author (Gabe 13:30, 20 April 2008 (CDT)) creates bode plots using the following commands
freqVec = logspace(-1, 3, 5000); [mag, phs] = bode(sys, freqVec * (2*pi)); mag = db(mag(:)); phs = phs(:); figure; subplot(2, 1, 1) semilogx(freqVec, mag) grid on title('System Bode Plot') ylabel('Magnitude (dB)') subplot(2, 1, 2) semilogx(freqVec, phs) grid on ylabel('Phase (deg)') xlabel('Frequency (Hz)')