Hi Wail,
I understand that you wish to generate directivity pattern in 3d in near field region. For that, you can leverage the patternCustom function of the Antenna Toolbox. This function allows the user to specify the distance from the antenna so that you can plot the desired pattern. To open up a sample code for this function, you can type in the following command in the MATLAB command window
>> openExample('antenna/VisualizeRadiationPatternFromAntennaDataFileExample')
Have a look at the Field Analysis - MATLAB & Simulink - MathWorks India page for better understanding
I hope this helps.