📄 pr5_11.m
字号:
%Problem 5.11;
%Verifying relations between periodic and aperiodic ACF;
clear all; close all;
N=11; %length of code;
A=2*unidrnd(2,1,N)-3; %now random binary code is set, but one may set whatever is wished;
p=zeros(1,N); %preparation of PACF
Ap=[A,A,A(1)]; Rp=xcorr(Ap,A)/(A*A'); Rp=Rp(2*N:3*N+2); %calculating PACF;
tau=[-1:N+1];
subplot(311); plot(tau,Rp); ylim([-1.2 1.2]); xlim([-1 N+1]); ylabel('R_{p}(\tau)'); xlabel('\tau/\Delta'); grid; %plotting PACF;
Ra=xcorr(A)/(A*A'); Ra0=Ra(N-1:end); RaN=[0,0,Ra(1:N),Ra(N+1)]; %calculating aperiodic ACF and its shifted replica;
subplot(312); plot(tau, [Ra0,0,0]); ylabel('R_{a}(\tau)'); ylim([-1.2 1.2]); xlim([-1 N+1]); xlabel('\tau/\Delta'); grid; %plotting aperiodic ACF;
subplot(313); plot(tau, RaN); ylabel('R_{a}(\tau-N\Delta)'); ylim([-1.2 1.2]); xlim([-1 N+1]); xlabel('\tau/\Delta'); grid; %plotting shifted aperiodic ACF;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -