📄 pr5_12.m
字号:
%Problem 5.12;
%calculating ACF of FSK signal;
clear all; close all;
N=10; %specify signal length;
M=N-2; %maximal number of fequencies used;
t=[0:0.01:N-0.01]; L=length(t); %time scale;
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=sign(sin(pi*[0:99]/100)); %half-wave sine chip;
Ch=Chip(1,:); %specifying chip form;
Cd=unidrnd(M,1,N); %frequency code is set random, but may be set any;
subplot(311); bar([0:N],[Cd 0],0.1); grid; xlabel('position number'); ylabel('frequency'); xlim([0 N]); ylim([0,M]); %plotting time-frequency pattern of FSK;
CE=kron(ones(1,N),Ch); Cdr=kron(Cd,ones(1,100)); CE=CE.*exp(i*2*pi*t.*Cdr); %complex envelope of FSK signal;
f0=10; car=exp(i*2*pi*f0*t); %setting carrier frequency
S=real(CE.*car); %bandpass FSK signal;
subplot(312); plot(t,S); grid; ylim([-1.2 1.2]); xlabel('t/\Delta'); ylabel('s(t)'); xlim([0 N]); %plotting FSK signal;
R=xcorr(CE); RR=abs(R(L:2*L-1))/(N*Ch*Ch'); %calculation ACF in range [0,L];
subplot(313); plot(t,RR); grid; ylim([-0.2 1.2]); xlabel('tau/\Delta'); ylabel('R(\tau)'); xlim([0 N]); %plotting ACF;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -