ip_02_04.m

来自「电子工业出版社出版的国外电子与通信教材系列一书:现代通信系统(MATLAB版)(」· M 代码 · 共 21 行

M
21
字号
% MATLAB script for Illustrative Problem 2.4.
echo on
N=1000;
M=50;
Rx_av=zeros(1,M+1);
Sx_av=zeros(1,M+1);
for j=1:10,        % Take the ensemble average over ten realizations
   X=rand(1,N)-1/2;    % N i.i.d. uniformly distributed random variables
               % between -1/2 and 1/2.
   Rx=Rx_est(X,M);          % autocorrelation of the realization
   Sx=fftshift(abs(fft(Rx)));   % power spectrum of the realization
   Rx_av=Rx_av+Rx;          % sum of the autocorrelations
   Sx_av=Sx_av+Sx;          % sum of the spectrums
   echo off ; 
end;
echo on ; 
Rx_av=Rx_av/10;                 % ensemble average autocorrelation
Sx_av=Sx_av/10;             % ensemble average spectrum
% Plotting comments follow
plot(Rx_av);
figure,plot(Sx_av)

⌨️ 快捷键说明

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