📄 pr2_51.m
字号:
%Problem 2.51;
%Simulates ML estimation of time delay and compares experimental and theoretical error standard deviations of the estimate;
clear all; close all;
T=[0:0.01:10]; N=length(T); %discrete time covering a priori interval of 1001 points;
SR=exp(-16*([0.01:0.01:1]-0.505).^2); SR=SR/norm(SR); %bell-shaped signal of duration 100 points and unit energy;
tau=input('tau(from(0,9])='); %input signal delay in terms of signal duration, number within (0,8] with no more than two digits after a decimal point;
fprintf('\n');
S=zeros(1,N); S(tau*100+1:tau*100+100)=SR; %time-shifted signal replica;
subplot(221), plot(T,S), grid; xlabel('t/T'), ylabel('s(t-tau)'), ylim([-0.2,1.2]*max(SR)); %plots delayed signal;
Nobs=1000; %sets number of observations;
q=10; %sets voltage SNR at the matched filter output;
No=normrnd(0,1/q,Nobs,N); %forms Nobs noise realizations
subplot(222), plot(T,No(1,:)); grid; xlabel('t/T'), ylabel('n(t)'); ylim([-4,4]/q); %plotting selected noise waveform;
Ob=No+kron(ones(Nobs,1),S); %Nobs observation waveforms;
subplot(223), plot(T,Ob(1,:)); grid; xlabel('t/T'), ylabel('y(t)'); ylim([-4,4]/q); %plotting selected observed waveform;
ZM=filter(SR,1,Ob'); ZM=ZM'; %matched filtering of Nos observations;
subplot(224),plot(T,ZM(1:10,:)'); grid; xlabel('tau/T'), ylabel('z(tau)'); %plotting correlations;
[Y,K]=max(ZM');
TEO=T(K)-1; %optimal estimations by maximum at the fiter output minus signal duration;
Avest=mean(TEO); Sigex=std(TEO); %mean and deviation of estimation;
Dereng=sum(diff(SR).^2)*1e4; %this quantity is equal to the minus second derivative (curvature) of ACF at zero point (see (2.59));
Sigth=1/(q*(sqrt(Dereng))); %theoretical value of sigma by Woodward formula;
disp(' SNR tau AvEst SigExp SigTh');
disp([q,tau,Avest,Sigex,Sigth]); %outputting voltage SNR, true tau, averaged over Nobs observation estimate of tau, experimental and theoretical standard deviations;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -