
close all
clear
clc

% Open loop transfer function G(s)
% G(s) = 1/(s+1)(s+3) = 1/(s^2 + 4*s + 3)
% den = [1 4 3];
% num = [1];
% tf_openloop = tf(num,den);

sys = tf([1],[1 4 3]);
[mag phase wout] = bode(sys);

h = plotyy(wout,20*log10(squeeze(mag)),wout,squeeze(phase),'semilogx','semilogx');
% Pretty up the plot by making the linewidth thicker, the marker size
% and font size bigger.

grid on

set(h(1),'FontSize',12)
set(h(2),'FontSize',12)
set(get(h(1),'Children'),'LineWidth',3)
set(get(h(2),'Children'),'LineWidth',3)
set(get(h(1),'Children'),'MarkerSize',100) % unnecessary because there are no markers
set(get(h(2),'Children'),'MarkerSize',100) % unnecessary because there are no markers

title('Bode Diagram of G(j\omega)= 1/(j\omega + 1)(j\omega+3))','FontSize',12)
xlabel('log(\omega)','FontSize',12)
set(get(h(1),'Ylabel'),'String','Magnitude','FontSize',12) 
set(get(h(2),'Ylabel'),'String','Phase','FontSize',12) 
