function applyBodePlotOpts(this,h,varargin)
%APPLYBODEPLOTOPTS  set bodeplot properties

%  Copyright 1986-2004 The MathWorks, Inc.
%  $Revision: 1.1.6.1 $   $Date: 2004/12/26 21:51:51 $

if isempty(varargin) 
    allflag = false;
else
    allflag = varargin{1};
end

% Apply Frequency Properties
h.AxesGrid.XUnits = {this.FreqUnits};
h.AxesGrid.XScale = {this.FreqScale};

% Apply Magnitude Properties
h.AxesGrid.YUnits(1) = {this.MagUnits};
h.AxesGrid.YScale(1:2:end) = {this.MagScale};
h.MagVisible = this.MagVisible;

if strcmpi(this.MagLowerLimMode,'auto')
    Preferences.MinGainLimit.Enable = 'off';
else
    Preferences.MinGainLimit.Enable = 'on';
end
Preferences.MinGainLimit.MinGain = this.MagLowerLim;

% Apply Phase Properties
h.AxesGrid.YUnits(2) = {this.PhaseUnits};
h.PhaseVisible = this.PhaseVisible;
if strcmp(this.PhaseWrapping,'off')
    Preferences.UnwrapPhase = 'on';
else
    Preferences.UnwrapPhase = 'off';
end

Preferences.ComparePhase = struct( ...
    'Enable',this.PhaseMatching, ...
    'Freq', this.PhaseMatchingFreq, ...
    'Phase', this.PhaseMatchingValue);

h.Preferences = Preferences;

% Call parent class method
if allflag
   applyRespPlotOpts(this,h,allflag);
end

