Polar2cartesian.m

From Spinach Documentation Wiki
Jump to: navigation, search

Converts [RF_amplitude, RF_phase] representation of a pulse waveform and the derivatives of any function with respect to those amplitudes and pha- ses into the [RF_x, RF_y] representation and the derivatives of the func- tion with respect to those X and Y RF values. Syntax:

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

Parameters:

   A       - vector of waveform amplitudes
   phi     - vector of waveform phases
   df_dA   - optional vector of derivatives of some scalar function  
             with respect to the waveform amplitudes.
   df_dphi - optional vector of derivatives of some scalar 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.

Outputs:

   x       - vector of waveform amplitudes along X
   y       - vector of waveform amplitudes along Y
   df_dx   - vector of derivatives of the function with respect to 
             the waveform amplitudes along X
   df_dy   - vector of derivatives of the 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