⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snrmse.m

📁 经典书籍《通信系统仿真原理与无线应用》chap8部分课后题仿真源代码
💻 M
字号:
function [gain,delay,px,py,rxy,rho,snrdb] = snrmse(x,y)
ln = length(x);               % length of the reference (x) vector
fx = fft(x,ln);                 % FFT the reference (x) vector
fy = fft(y,ln);                 % FFT the measurement (y) vector
fxconj = conj(fx);             % conjugate the FFT of the reference vector
sxy = fy .* fxconj;             % determine the cross PSD
rxy = ifft(sxy,ln);              % determine the cross correlation function
rxy = real(rxy)/ln;             % take the real part and scale
px = x*x'/ln;                  % determine power in reference vector
py = y*y'/ln;                  % determine power in measurement vector
[rxymax,j] = max(rxy);         % find the max of the cross correlation
gain = rxymax/px;            % system gain
delay = j-1;                  % system delay
rxy2 = rxymax*rxymax;        % square rxymax for later use
rho = rxymax/sqrt(px*py);      % correlation coefficient
snr = rxy2/(px*py-rxy2);        % snr
snrdb = 10*log10(snr);         % snr in db
% End of function file.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -