📄 pr8_13.m
字号:
%Problem 8.13;
%dinamics of acquisition of SS signal;
clear all; close all;
n=8; % m-sequence memory no smaller than 7;
rf=kron(1-2*bmsq(n),ones(1,2)); %forming reference m-sequence with oversampling two times to imitate half-chip steps;
N=length(rf);
tau=unidrnd(200,1,1); %reference initial random time shift;
s=[rf(tau+1:N) rf(1:tau)]; %time shifted signal;
sgm=sqrt(N)/8; %setting noise level;
y=kron(ones(5,1),s)+normrnd(0,sgm,5,N); %5 observation realizations: noisy signal for plotting formed;
t=[0:199]; L=length(t); %time scale;
subplot(411); stairs(t/2,s(1:L)); ylim([-1.2,1.2]); ylabel('s(t-\tau)'); grid; %plotting pure signal;
subplot(412); plot(t/2,y(:,1:L)); ylim([-3*sgm,3*sgm]); ylabel('y(t)'); grid; %plotting noisy signal;
subplot(413); stairs(t,rf(1:L)); ylim([-1.2 1.2]); ylabel('s(t-t_{ref})'); grid; %plotting current state of reference
pause(0.1);
Z=zeros(1,L); thr=0.5; %setting threshold;
for k=0:10*N-1
y=s+normrnd(0,sgm,1,N); % update observation;
z=(y(1,:)*rf')/N; %current correlation calculation;
subplot(413); stairs(t/2,rf(1:L)); ylim([-1.2 1.2]); ylabel('s(t-t_{ref})'); xlabel('t/\Delta'); grid; %plotting current state of reference
Z(mod(mod(k,N),200)+1)=z;
subplot(414); plot(t/2,Z); ylim([-0.5 1.2]); xlabel('t_{ref}/\Delta'); ylabel('z(t_{ref})'); grid; %plotting current correlation;
if z>thr; break, end;
pause(0.1);
rf=[rf(2:N) rf(1)]; %reference next shift;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -