function handles = CLFigure()
% CLFigure closed loop bode figure
%   CLFigure opens a new figure for close loop bode plot

%   Project: IMPACT
%   Title of Code: CLFigure
%   Relevant additional documentation:
%   Developer: Carlos Gonzalez
%   External Dependencies: NA
%
%   Disclaimer
%   CAUTION: It is strongly recommended that changes to this code
%   should be avoided without first consulting with authors.

hFigCL = figureMLS(...
        'MenuBar',      'none',...
        'Position',     [200, 100, 600, 600], ...
        'Color', get(0,'defaultUicontrolBackgroundColor'),...
        'Name',         'Closed loop',...
        'NumberTitle',  'off',...
        'DockControls', 'off',...
        'Visible',      'on',...
        'tag',          'closeLoopFig',...
        'MenuBar',      'figure',...
        'Resize',    'on'); % open a new figure
    
figure(hFigCL);
axesMag = subplot(2, 1, 1);
colorGray = [0.4 0.4 0.4];
title('Closed Loop Bode Plot', 'Color', colorGray);
ylabel('Magnitude (dB)', 'Color', colorGray);
set(axesMag, 'XScale', 'log', ...
    'XTickLabel', [], ...
    'XColor', colorGray,...
    'YColor', colorGray);
% axis phase
axesPhase = subplot(2, 1, 2);
xlabel('Frequency (rad/s)', 'Color', colorGray)
ylabel('Phase (deg)', 'Color', colorGray)
set(axesPhase, 'XScale', 'log', ...
    'XColor', colorGray,...
    'YColor', colorGray);

linkaxes([axesMag,axesPhase],'x');
handles.hFigCL = hFigCL;
handles.axesMagCl = axesMag;
handles.axesPhaseCl = axesPhase;