MATLAB: Is it possible to allow switching between cartesian grid and plot type grids in the Control System Toolbox 8.3 (R2009a)

Control System Toolbox

I am unable to select switching between the cartesian and plot type grids in the Control System toolbox. Currently, both the GRID and SGRID functions place a zeta-wn grid on the root locus.
I would like to be able to have the functionality to allow the Cartesian grid, which establishes lines of constant settling time and peak overshoot. For example:
h = tf([2 5 1],[1 2 3]);
rlocus(h)
sgrid
Yields the same result as:
h = tf([2 5 1],[1 2 3]);
rlocus(h)
grid

Best Answer

The ability to do switch between cartesian and plot type grids using SGRID or GRID is not available in the Control System Toolbox 8.3 (R2009a).
To work around this issue, you can superimpose horizontal and vertical lines on the plot as given below. The following example is for vertical grid lines and can be extended to horizontal lines as well.
ax = gca;
rlocus(zpk([],[-2,-3,-5],1))
hold on
yminmax = get(ax,'ylim'); % min max of vertical grid lines
xdata = get(ax,'xtick'); % Location of x grid lines eg xdata = [1,2,3,4]
lxdata = [];
lydata = [];
for ct = 1:length(xdata)
lxdata = [lxdata; xdata(ct)*ones(2,1); NaN];
lydata = [lydata; yminmax(:); NaN];
end
vertgridline = line(lxdata,lydata,'color',[.8,.8,.8],'linestyle',':');
% to delete these gridlines
%remove grid lines
delete(vertgridline)