MATLAB: Problems with snr function

noisesignalSignal Processing Toolboxsnr

I want to find the snr for signal xn and noise ns but I keep getting an error.
clear;
n = [0:1023];
omega = 0.25*pi;
xn = sin(omega*n);
count = 1024;
ns = sqrt(0.2)*randn(1,count);
r = snr(xn,ns);
plot(r);
??? Undefined function or method 'snr' for input arguments of type 'double'.

Best Answer

How about:
theRatio = xn ./ ns;
theSNR = mean(theRatio);
Related Question