pkg load control   %remove this line if using MATLAB
clear all
clc

%sys=tf(1,[1 3 2 .5]);
sys=tf(1,[1 -2]);   %this system is open-loop unstable
[AR,Ph,w]=bode(sys);
close all

%bode(sys)

figure
subplot(2,1,1)
loglog(w,AR,'LineWidth',2)
grid on
xlabel('\omega','FontSize',18)
ylabel('AR','FontSize',18)
set(gca,'FontSize',13)

subplot(2,1,2),
semilogx(w,Ph,'LineWidth',2)
ytick=[0 -50 -80 -120 -180 -230 -270 -300];
set(gca,'ytick',ytick);
grid on
ylabel('\Phi','FontSize',18)
xlabel('\omega','FontSize',18)
set(gca,'FontSize',12)