📄 experiment6_1.m
字号:
% Experiment 6, CS: Haykin% Generating 127-chip PN sequences% polynomial1(x) = x^7 + x+1% polynomial2(x) = x^7+x^6 + x^5 + x^4 + 1% Autocorrelation and cross correlation functions% requires functions pn_corr.m, PNseq.m, shift_register.m to run% polynomialspol1=[1 0 0 1 0 0 0 1];pol2=[1 1 1 1 0 0 0 1];% chip sizeN=127;% generating the PN sequencepnseq1 = PNseq(pol1);pnseq2 = PNseq(pol2);% mapping antipodal signals (0-->-1, 1-->1)u=2*pnseq1-1;v=2*pnseq2-1;% autocorrelation of pnseq1[corrf]=pn_corr(u, u, N);% printsfigure(1)plot(-125:126,corrf(2:253)); axis([-126, 126,-10, 150])xlabel(' Delay \tau')ylabel(' Autocorrelation function R_{c}(\tau)')%autocorrelation of pnseq2[corrf]=pn_corr(v, v, N)% printsfigure(2)plot(-125:126,corrf(2:253)); axis([-126, 126,-10, 150])xlabel(' Delay \tau')ylabel(' Autocorrelation function R_{c}(\tau)')% cross correlation of pnseq1, pnseq2[c_corr]=pn_corr(u, v, N)% printsfigure(3)plot(-125:126,c_corr(2:253)); axis([-126, 126,-20, 20])xlabel(' Delay \tau')ylabel(' Cross-correlation function R_{ji}(\tau)')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -