Problems with snr function
이전 댓글 표시
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'.
채택된 답변
추가 답변 (2개)
Guillaume
2014년 9월 20일
Sounds like you don't have the signal processing toolbox.
ver
will tell you which toolboxes you have installed.
댓글 수: 2
Image Analyst
2014년 9월 20일
편집: Image Analyst
2014년 9월 20일
Or it's an antique version. I think snr() has not always been part of the Signal Processing Toolbox, but it's simple enough to calculate manually.
Dick Rusell
2014년 9월 20일
편집: Dick Rusell
2014년 9월 20일
Youssef Khmou
2014년 9월 20일
편집: Youssef Khmou
2014년 9월 20일
Generally the formula is SNR=20log10(std(signal)/std(noise)) , in your case you have :
snr=20*log10(std(xn)/std(ns)) % 3.8dB
카테고리
도움말 센터 및 File Exchange에서 Signal Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!