Effects
Tips

Function sigrid: Plotting the sigma Requirement on a Root Locus

Below is the function sigrid.m. This function will plot the sigma requirement on the same graph as another plot, such as a root locus plot generated with the rlocus command. To employ sigrid.m in MATLAB, use the syntax sigrid(sigma). Copy the following text into a file sigrid.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[ ] = sigrid(sig)
         %SIGRID  Generate s-plane grid lines for a root locus or pole-zero map.
         %
         %       SIGRID generates a grid over an existing continuous s-plane root
         %       locus or pole-zero map.  Lines of constant sigma are drawn in.
         %       To be used with SGRID if sigma, zeta, and Wn requirements are required
         %       simultaneously.  Can also be used by itself.
         %
         %       See also: RLOCUS, ZGRID, SGRID, and PZMAP.
         error(nargchk(1,1,nargin));
         hold on
         %Plot sigma line
         limits = axis;
         mx=limits(1,4);
         mn=limits(1,3);
         stz=abs(mx)+abs(mn);
         st=stz/50;
         im=mn:st:mx;
         lim=length(im);
         for i=1:lim
         re(i)=-sig;
         end
         re(:);
         plot(re,im,'.')
         hold off
         return