Cartesian2polar.m

From Spinach Documentation Wiki
Jump to: navigation, search

Converts the [RF_x, RF_y] representation of a pulse waveform and the derivatives of any function with respect to those RF values into the [RF_amplitude, RF_phase] representation and the derivatives of the function with respect to the amplitudes and phases. Syntax:

       [A,phi,df_dA,df_dphi]=cartesian2polar(x,y,df_dx,df_dy)

Parameters:

   x       - vector of waveform amplitudes along X
   y       - vector of waveform amplitudes along Y
   df_dx   - optional vector of derivatives of a scalar function
             with respect to the waveform amplitudes along X
   df_dy   - optional vector of derivatives of a scalar function
             with respect to the waveform amplitudes along Y
   d2f_dx2 - optional matrix of second derivatives of a scalar function
             with respect to the waveform amplitudes along X
   d2f_dxdy- optional matrix of second derivatives of a scalar function
             with respect to the waveform amplitudes along X and Y
   d2f_dy2 - optional matrix of second derivatives of a scalar function
             with respect to the waveform amplitudes along Y

Outputs:

   A       - vector of waveform amplitudes
   phi     - vector of waveform phases
   df_dA   - vector of derivatives of the function with respect
             to the waveform amplitudes.
   df_dphi - vector of derivatives of the function with respect
             to the waveform phases.
   d2f_dA2 - matrix of second derivatives of the function with respect
             to the waveform amplitudes.
 d2f_dAdphi- matrix of second derivatives of the function with respect
             to the waveform amplitudes and phases.
  d2f_dphi2- matrix of second derivatives of the function with respect
             to the waveform phases.