GPMargin:

--------------------------------------------------------------------------
   Computes gain and phase margins from magnitude and phase.

   Since version 1.
--------------------------------------------------------------------------
   Form:
   [gM, wG, pM, wP] = GPMargin( m, p, w )
   [gM, wG, pM, wP] = GPMargin( g, w )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   m                 Gain (db) or complex transfer function
   p                 Phase (deg)
   w                 Frequency vector

   -------
   Outputs
   -------
   gM                Gain margin (dB)
   wG                Frequencies of gain crossovers (rad/sec)
   pM                Phase margins (deg)
   wP                Frequencies of phase crossovers   (rad/sec)         

--------------------------------------------------------------------------