% Function for calculating the Ms value
% witen by: Chriss Grimholt 11 jan. 2012

function mt = mt(gp, gc)

mt = max(abs(freqresp(gp*gc/(1+gp*gc),logspace(-2,2,150000))));

% 
% w0 = 0.1;
% [wmax, ms] = fminsearch(@(w) -max(abs(freqresp(1/(1+gp*gc),w))),w0)
% ms =-ms;
% ms_cnt = max(abs(freqresp(1/(1+gp*gc),logspace(-2,2,80000))));
% 
% if ms_cnt > ms
%     ms = ms_cnt
%     disp('*')
% end

%ms = norm(pade(1/(1+gp*gc),20),inf,1e-8);
return