function dummy = getmargins(LoopData)
%GETMARGINS  Computes stability margins.

%   Authors: P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.2 $  $Date: 2000/06/14 20:18:27 $

% REVISIT
dummy = [];

% No warning
WarnState = warning('off');

% Compute margins
GainMag = abs(getgain(LoopData));
% RE: Units are: GM(absolute)  Pm(degree)  Wcg,Wcp(radians/sec)
[Gm,Pm,Wcg,Wcp,isStable] = margin(GainMag * LoopData.OpenLoop);

warning(WarnState);

% Store result
LoopData.Margins = ...
    struct('Gm',Gm,'Pm',Pm,'Wcg',Wcg,'Wcp',Wcp,'Stable',isStable);
