function K0=ps14f_6242_2004(N) % function K0=ps14f_6242_2004(N) % % gain margin estimation for Problem 1.4(f) in 6.242/2004 w=(1:N)'*50/N; % frequency samples sqrts=((1+j)/sqrt(2))*sqrt(w); % sqrt(s) samples Gs=2./(sqrts.*(exp(sqrts)-exp(-sqrts))); % G samples ir=imag(Gs); ir=ir(1:N-1).*ir(2:N); y=min(real(Gs(ir<=0))); K0=-1/y; close(gcf) subplot(2,1,1); plot(w,real(Gs),w,repmat(y,N,1)); grid subplot(2,1,2); plot(w,imag(Gs)./max(0.1,abs(imag(Gs)))); grid