pr6_51.m

来自「Spread Spectrum and CDMA Principles and 」· M 代码 · 共 20 行

M
20
字号
%Problem 6.51;
%Perfection of periodic ACF of Chu and Frank codes; If N is integer square
%Frank code is formed otherwise Chu code;

clear all; close all;
N=input('length N='); %inputting length;
t=[0:N-1]; %time scale;
h=floor(sqrt(N));
if h^2==N
    a=exp(i*2*pi*(t.*floor(t/h))/h); %if N is squared integer, Frank code is formed;
else %otherwise Chu code is formed;
    s=rem(N,2)+1; %to discriminate between even and odd N for forming Chu code;
    a=exp((i*s*pi*t.^2)/N); %Chu code formed;
end;
Ra=xcorr(a); Rp=[0 Ra(1:N-1)]+Ra(N:2*N-1); %PACF calculated;
R=abs(Rp)/N; %norming PACF;
subplot(211);
stairs([0:2*N],angle([a a a(1)])); xlabel('t/\Delta'); ylabel('Fi(t)'); xlim([0 2*N]); ylim([-pi-0.2 pi+0.2]); grid; %plotting signal phase code;
subplot(212);
plot([0:2*N],[R R R(1)]); xlabel('\tau/\Delta'); ylabel('Rp(tau)'); xlim([0 2*N]); ylim([-0.2 1.2]); grid; %plotting PACF;

⌨️ 快捷键说明

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