📄 sa_fig6_35.m
字号:
% Figure 6.35 CDMA pn code correlated with itself and a delayed version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Nchips -- number of chips
% nsamples -- number of samples per chip.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Nchips = 32;
nsamples = 12;
CDMA = [];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generate code
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a = sign(randn(1,Nchips));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sample codes nsamples times per chip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:length(a),
CDMA = [CDMA,a(i)*ones(1,nsamples)];
end
CDMA1=[CDMA zeros(1,36)];
CDMA2=[zeros(1,16) CDMA zeros(1,20)];
t=(0:length(CDMA1)-1)*2/(length(CDMA1)-1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Correlate CDMA1 with itself and with CDMA2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
R1=sum(CDMA1.*CDMA1)
R2=sum(CDMA1.*CDMA2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plotting the CDMA waveforms
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
subplot(2,1,1)
plot (t,CDMA1,'k');
axis([0 2 -1.2 1.2])
xlabel('time \muSec')
title('Waveform with 0 excess delay')
subplot(2,1,2)
plot(t,CDMA2,'k');
axis([0 2 -1.2 1.2])
xlabel('time \muSec')
title('Waveform with 1.3\tau excess delay')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -