⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pr5_10.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem 5.10;
%calculating of ACF of discrete signal and demonstration of its relation to
%chip and code ACFs;

clear all; close all;
N=7; Ns=N*100; %length of a discrete signal;
t=[0:Ns-1]/100; %time scale;
Per=0; %put this equal to zero for aperiodic and one for periodic signals;
Chip=[ones(1,100);sin(pi*t(1:100));exp(-16*(t(1:100)-0.5).^2)]; %chips: rectangular, half-sine, and bell-shaped;
Ch=Chip(3,:); %chip form selection;
A=2*unidrnd(2,1,N)-3; %code sequence; 
S=kron(A,Ch); S1=[Per*S,S,Per*S]; R=xcorr(S1,S)/(S*S'); R=R(3*Ns:5*Ns); %APSK signal and its directly calculated ACF;
tau=[-N,-t(Ns:-1:2),t,N]; %tau scale;
subplot(411); plot(tau,[Per*S,S,S(1)]); ylim([-1.3 1.3]); ylabel('S(t)'); xlabel('t/\Delta'); grid; xlim([-N,N]); %plotting signal;
subplot(412); plot(tau,R); ylim([-1.3 1.3]); ylabel('R(\tau)'); xlabel('tau/\Delta'); grid; xlim([-N,N]); %plotting directly calculated ACF;
Rc=xcorr(Ch)/(Ch*Ch'); %ACF of chip;
subplot(413); plot(tau,[zeros(1,Ns-99) Rc zeros(1,Ns-99)]); ylim([-0.3 1.3]); ylabel('R_{ch}(\tau)'); xlabel('\tau/\Delta'); grid; xlim([-N,N]); %plotting chip ACF;
A1=[Per*A,A,Per*A]; Rcd=xcorr(A1,A)/(A*A'); Rcd=Rcd(3*N:5*N); %ACF of code
subplot(414); bar([-N:N],Rcd,0.1); xlim([-N N]); ylim([-1.3 1.3]); ylabel('R_{cd}(\tau)'); xlabel('m'); grid; %plotting directly calculated ACF;

⌨️ 快捷键说明

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