CMU
UM


Function jgrid:
plotting the damping and sigma requirements on the root locus

Below is the function jgrid.m. This function will plot the damping and sigma requirements on the same graph as another plot, such as an rlocus. To use jgrid.m in matlab enter jgrid(zeta,sigma). Copy the following text into a file jgrid.m, and put it in the same directory as the Matlab software, or in a directory which is contained in Matlab's search path.


function[ ] = jgrid(zeta,sigma)
%JGRID  Generate s-plane grid lines for a root locus or pole-zero map.
%
%       JGRID generates a grid over an existing continuous s-plane root 
%       locus or pole-zero map.  Lines of constant damping ratio (zeta)
%       and sigma are drawn in.
%
%       See also: RLOCUS, ZGRID, SGRID, and PZMAP.

error(nargchk(2,2,nargin));

status = ishold;

hold on

%Plot sigma  line
    limits = axis;
    for i = 1:30*max(limits(:)),
        sl(i) = 1;
    end
    [w,z] = meshgrid(sigma,sl);
    re = -w.*z;
    [mcols, nrows] = size(z);
    im = 0.1:0.1:3*max(limits(:));
    plot(re,im,'w:',re,-im,'w:');
    hold on

%Plot  damping lines
    [w,z] = meshgrid([0;sigma(:);2*max(limits(:))]',zeta);
    re =  -w.*z;
	[mcols, nrows] = size(z);
    im = w.*sqrt( ones(mcols,nrows) -z.*z);
	plot(re',im','w:',re',-im','w:');

if (~status), hold off, end

Use your browser's "Back" button to return to the previous page.

8/28/96 JDP