📄 pr6_39.m
字号:
%Problem 6.39;
%simulating and analysis of destructive role of ACF sidelobes in time
%measuring;
clear all; close all;
S=ones(1,10); BG=[1 1 -1 1 1 1 -1 1 1 1 -1;1 -1 1 1 -1 1 1 1 -1 -1 -1]; %chip and two codes: bad and good;
CE=kron(BG,S); %two complex envelopes;
N=size(CE,2); %length of signal vector;
t=[-N+1:N-1]/10; %time scale;
No=normrnd(0,3,1000,3*N)+i*normrnd(0,3,1000,3*N); %1000 realizations of additive noise;
for k=1:2 %in the loop identical operations are done over both signals;
CEk=CE(k,:);
subplot(4,2,k); plot(t,[CEk,zeros(1,109)]); xlim([-11,11]); ylim([-1.2 1.2]); ylabel('S(t)'); grid; %plotting bad and good signal complex envelopes;
R=abs(xcorr(CEk))/(CEk*CEk'); %signal ACF calculation;
subplot(4,2,k+2); plot(t,R); xlim([-11,11]); ylim([-0.2 1.2]); ylabel('R(\tau)'); grid; %plotting ACF;
Y=ones(1000,1)*[zeros(1,N),CEk,zeros(1,N)]+No; %1000 observations;
mf=abs(filter(CEk(N:-1:1),1,Y'))/(CEk*CEk'); mf=mf(N+1:3*N-1,:); mfd=mf(:,1:10); mfd=mfd'; %matched filtering of observations and selecting 10 realization for displaying;
subplot(4,2,k+4); plot(t,mfd); xlim([-11,11]); ylim([-0.2 2]); ylabel('MF output'); grid;
[M,tau]=max(mf); taest=t(tau); %1000 estimates of time delay;
subplot(4,2,k+6); hist(taest,25); xlim([-11,11]); ylim([0,100]); xlabel('\tau/\Delta'); %plotting histogram of delay estimates;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -