%phase_lead.m
%Problem 6.45

clc
clear all

num=5
den=poly([0 -1 -5])/5

sys=tf(num,den)

figure(1)
margin(sys)

phimax=65
alpha=(1-sin(phimax/180*pi))/(1+sin(phimax/180*pi))

omegamax=10
T=1/(omegamax*sqrt(alpha))

zero=1/T
pole=1/(alpha*T)

numc=[T 1]
denc=[alpha*T 1]

sysc=tf(numc,denc)

sysL=series(sys,sysc)

figure(2)
margin(sysc)

figure(3)
margin(sysL)