OutputPort1 = InputPort1;

	
m_dRefractiveIndex = 2;
M_PI = pi;
m_dWavelength = 850e-9;
m_dFocus = 1e-3;
m_dVortexParameter = 4;

s = size(OutputPort1.Sampled.Spatial.ModeX.Amplitude);

k = s(1);
l = s(2);

dSpaceX = OutputPort1.Sampled.Spatial.ModeX.DeltaSpaceX;
dSpaceY = OutputPort1.Sampled.Spatial.ModeX.DeltaSpaceY;

dLengthX = k * dSpaceX;
dLengthY = l * dSpaceY;

for m = 1:k
    for n = 1:l        
        
        dX = (m - 1 )* dSpaceX - dLengthX / 2;
        dY = (n - 1 )* dSpaceY - dLengthY / 2;

        dRadiusPow	= dX * dX + dY * dY;
        dAngle		= atan2( dX , dY );
        dValue      = m_dRefractiveIndex * M_PI * dRadiusPow / ( 2 * m_dWavelength * m_dFocus ) + m_dVortexParameter * dAngle;

        OutputPort1.Sampled.Spatial.ModeX.Amplitude(m,n) = InputPort1.Sampled.Spatial.ModeX.Amplitude(m,n) * exp( i * dValue );        
    end
end

%contourf(angle(OutputPort1.Sampled.Spatial.ModeX.Amplitude))

