% Matlab Self Paced example: File = logplots.m
% Plots using log scale on x-axis and on both axes

% Create values to be plotted and title string
kmax = 100;
K = [1:kmax].^2;
pow = -0.4;
Y = K.^pow;
str = sprintf('y(k) = k^{%.2f}  for k = 1, 4, 9,...,%d', pow, max(K));

% Create figure window 1 with three subplots
figure(1)
subplot(3,1,1);
plot(K, Y, '.');
grid on
title([str ' using linear scales']);
subplot(3,1,2);
semilogx(K, Y, '.');
grid on
title([str ' using log scale for x-axis']);
subplot(3,1,3);
loglog(K, Y, '.');
grid on
title([str ' using log scale for both axes']);