"% my aim is to get which filter is successful psnr values on this salt and pepper noise."
If you check the format of the PSNR calculation you may get the answer
Then this one to see the performance of medfilt2 and imgaussfilt filter on the particular noisy image. Here SP is the noisy imag, MDSP and GSP are the filtered images(on Noisy Image) using medfilt2 and imgaussfilt respectively.
More, then what does "1" means in the code
Here, if you carefully notice, here SP is the noisy image, on the other hand MDO and GO are the filtered images on the Original Image. Here in '1' applied the filters on original image, not the noisy image.