You have to frame the technical question correctly. People do not know what your "current step" is. Most likely, they will google the keywords and send you many sitelinks that appear in the Google Search results related to ANFIS and PSO.
Deep down, you know that the sample code does not solve your Engineering Problem in your Project, if your do not understand how it works to solve the Engineering Problem in the first place. What you truly need is an Engineering Solution to the Non-Destructive Vibrational-based Structural Crack Detection.
You probably do not need PSO, if your Fuzzy Logic Rules works good enough to identify/predict/estimate the location of the cracks from the measured frequency responses at certain lengths of the rigid structure (say a cantilever beam).
Generally, when optimization techniques are applied to models like ANN and ANFIS, the role of the optimization algorithm is adjusting the parameters of the model so that the best training is obtained. For example in ANFIS-PSO here, the PSO tunes the parameters of the membership functions of ANFIS so that the lowest training error is achieved. It takes a large number of iterations until the model reaches a stable response.
Fowwling the PSO-ANFIS code you have, ANFIS is applied to the training data and once trained, training outputs are produced. An error value is calculated accordingly, and PSO tries to tune the ANFIS over and over so that this error is minimized.
You have mentioned that you designed the ANFIS using a toolbox in MATLAB. I presume that you used either the command-line anfis function or the Neuro-Fuzzy Designer app to design the ANFIS. The built-in anfis function has the capability to tune/shape the input membership functions, if you select the subtractive clustering method. What is the purpose of using PSO?
The design of the ANFIS model is very simple. No need to use PSO Algorithm for MF parameters optimization. You should just review the various membership functions and report the best results. It is recommended to use FCM clustering not grid partioning (Time problem).