Getting error in PSNR calculation using Matlab I want to find out PSNR and SNR values of two images A and B of same dimension in Matlab.I used the following code

[peaksnr, snr] = psnr(A,B)


and getting an error 

Undefined function 'psnr' for input arguments of type 'uint8'.


Then I converted both the images into double as follows

A = double(A);
B = double(B);  


and again PSNR is calculated.Now I'm getting an error

Undefined function 'psnr' for input arguments of type 'double'.


Why this is happening?Please help me to troubleshoot the error.
Why this is happening?

The answer is quite simple and the error message exactly tells you what is wrong: Apparently you do not have the function psnr() available on your system.

This might have many reasons. Most probably:


You are missing a Matlab toolbox that provides this function
You are missing a Matlab script that provides this function


If you have the script, then Matlab does not know about it. Check your Matlab path settings