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

function ms = ms(gp, gc,opt)

log_w = logspace(-4,4,40000);
[ms,index_log_w] = max(abs(freqresp(feedback(1,gp*gc),log_w)));
% w = log_w(index_log_w);
% [~, ms] = fminsearch(@(w) -abs(freqresp(feedback(1,gp*gc),w)),w,opt);
% ms=-ms;
return