The Fraunhofer equation offers a simplification that makes some simple example cases computable by a human being. With a computer and MatLab, this probably isn’t the right approach. Perhaps you are using Fraunhofer as shorthand for “far field” as defined by the Fraunhofer condition, and weren’t really suggestion using the Fraunhofer equation.
In any case, for propagating a near field condition to the far field using MatLab I think you will want to use FOURIER OPTICS. The wikipedia article is a good introduction. However, it dedicates a lot of complicated description to prove to you the basic premise is true: the field in the far field is the Fourier transform of the near field.