In this paper the main challenge is to find the optimal architecture of modular neural networks, which means finding out the optimal number of modules, layers and nodes of the neural network, with the fuzzy gravitational search algorithm for a pattern recognition application and in addition provide a comparison with the original gravitational approach. The proposed method is applied to the recognition of medical images. One of the most common methods for detection and analysis of diseases in the human body, by physicians and specialists, is the use of medical images. In this case, we are using a database of echocardiograms, which contains images of disease and healthy patients to test the proposed approach. The optimally designed modular neural networks produce simulation results that are able to show the advantages of the proposed approach