# Getting different results when running my program at different times [closed]

I am working on Speckle Noise reduction in Ultrasound Images using MATLAB R2013. I have designed 10 basic filters and trying out hybrid combination using these filters. When I run my program I get different results at different time for the same input image, no other input parameters were changed. When I ran my program at 1.17 am, I got the PSNR = 74.5424 and when I ran the same program at 1.21 am, I got PSNR = 75.04. Why this is happening ?

If it is coming different values at every time I run my program, how could I conclude on a single value ? Please help. I have attached the screenshot below, see the values of SNR, PSNR, Beta and Speckle Index.

• Two comments: 1) this is more of a programming question than a signal processing question, and 2) the program probably "remembers" its state from one run to another, so the different initial states are changing the results. – Jim Clay Jan 9 '14 at 1:39
• Do you generate the input image inside your program? Do you add noise to it inside your program? – Dima Jan 9 '14 at 2:03
• @Dima, No I did not generate image inside my program.. Yes, I have added the noise inside my program – Premnath D Jan 9 '14 at 6:48
• If you added noise inside your program, and it is based on some kind of random generator, that very possibly depends on time. The answers for different random noise treated with the same procedure should be similar, but never the same. You could try averaging, or taking a median, of multiple different runs. – penelope Jan 9 '14 at 10:48
• Or you can seed the random number generator with the same value every time. – John Jan 9 '14 at 15:36

imnoise for speckle noise adding is not deterministic. I would suggest you save the noise image after imnoise by calculate the difference between the noise added image and the raw clean image. When you test other filters and want to make a comparison, directly add the noise image to the raw image.

Or you can repeat the filter experiment many times (each time use imnoise) and get an average of PSNR, SNR, and Beta.

• you are very welcome! – lennon310 Jan 9 '14 at 17:37