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

📄 snrmse.m

📁 很多MATLAB的无线系统仿真实例。强烈推荐!
💻 M
字号:
% File: snrmse.m
% Software given here is to accompany the textbook: W.H. Tranter, 
% K.S. Shanmugan, T.S. Rappaport, and K.S. Kosbar, Principles of 
% Communication Systems Simulation with Wireless Applications, 
% Prentice Hall PTR, 2004.
%
function [gain,delay,px,py,rxy,rho,snrdb] = snrmse(x,y)
ln = length(x);                 % Set 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 crosscorrelation
gain = rxymax/px;               % Here's the gain
delay = j-1;                    % Here's the delay
rxy2 = rxymax*rxymax;           % Square rxymax for later use
rho = rxymax/sqrt(px*py);       % Here's the correlation coefficient
snr = rxy2/(px*py-rxy2);        % Here's the snr
snrdb = 10*log10(snr);          % Here's the snr in db
% End of script file.

⌨️ 快捷键说明

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