N = 1000;

w = logspace(-2,4,N);

s = j*w;





Gf = 24./(s.*(s/3+1).*(s/200+1));

Gc = 435/24*(s/80+1).^2;

L = Gf.*Gc;



r = abs(L);

phi = phase(L);



for k = 1:N

    if(r(k)<0.01)

        break;

    end

end

w_c = 1/2*(w(k)+w(k-1))

% Critical phase corresponding to w_c

phi_c = 1/2*(phi(k)+phi(k-1));

phi_M = 180/pi*(pi+phi_c)



