%%%%%%%%%%%%%%%%%%% DETECTION AND ESTIMATION THEORY %%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%% SANA SYED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% FIGURE 7.3 AND 7.4 %%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
close all
N=50;
m=1000;
A=1;
sigma_sq=0.05;
f0=0.08;
phi=pi/4;
k=1;
SNR = -20:5:10; % Define SNR for plotting the figure
for k=1:length(SNR)
Pdf=[];
phi_hat=[];
x=zeros(m,N);
for M=1:m
n=0:1:N-1;
noise=sqrt(sigma_sq)*awgn(zeros(1,N),SNR(k)); % changing SNR
x(M,:)=A*cos(2*pi*f0*n+phi)+noise;
%x(M,:)=awgn((A*cos(2*pi*f0*n+phi)),SNR(k));
Pdf(M,:)=(1/(2*pi*sigma_sq)^(1/2))*(exp((-1/(2*sigma_sq))*(x(M,:)-A.*cos(2*pi*f0*n+phi)).^2));
Num=sum(x(M,:).*sin(2*pi*f0*n));
Den=sum(x(M,:).*cos(2*pi*f0*n));
phi_hat(M,:)=-atan(Num/Den);
end
phi_est(k)=(1/M)*sum(phi_hat);
phi_var(k)=N*(1/M)*sum((phi_hat-phi_est(k)).^2); % eq 7.10
end
% Compare actual mean with asymptotic mean against SNR
figure;
asymp_mean = pi/4*ones(1,length(SNR)); % Asymptotic mean
plot(SNR,asymp_mean,'r--','LineWidth',2);
hold on;
plot(SNR,phi_est,'LineWidth',2)
xlabel('SNR (dB)','FontWeight','bold','fontsize',12);
ylabel('Mean','FontWeight','bold','fontsize',12);
title('Actual vs. asymptotic mean for phase estimator','FontWeight','bold','fontsize',12);
legend('Asymptotic mean','actual mean');
% Compare actual variance with asymptotic variance against SNR
lg_asymp_var = -10*log10(N) - SNR; % Asymptotic variance
lg_var = 10*log10(phi_var);
figure;
plot(SNR,lg_asymp_var,'r--','LineWidth',3);
hold on;
plot(SNR,lg_var,'LineWidth',3)
xlabel('SNR (dB)','FontWeight','bold','fontsize',12);
ylabel('10log_1_0 variance','FontWeight','bold','fontsize',12);
title('Actual vs. asymptotic variance for phase estimator','FontWeight','bold','fontsize',12)
legend('Asymptotic variance','actual variance');
%
Kinonoyomeo
- 粉丝: 92
- 资源: 1万+
最新资源
- 11-【其他】09-新进员工教育内容检查表.doc
- 11-【其他】11-新进职员研修事项检查表.doc
- 11-【其他】14-新员工入职培训反馈表 (2).doc
- 11-【其他】12-新员工岗位培训反馈表.doc
- 11-【其他】13-新员工培训成绩评核表.DOC
- 11-【其他】16-新员工入职培训跟踪记录表.doc
- 11-【其他】15-新员工入职培训反馈表.doc
- 11-【其他】18-新员工入职培训相关表格(最新版).doc
- 00-【管理制度】03-新员工入职培训管理制度.docx
- 00-【管理制度】04-新员工入职培训管理制度1.docx
- 00-【管理制度】06-新员工入职培训管理制度.docx
- 01-【培训计划】05-新员工入职培训计划.docx
- 01-【培训计划】01-入职培训流程计划.docx
- 01-【培训计划】12-新员工培训实施建议.docx
- 01-【培训计划】06-新员工入职培训计划.docx
- 01-【培训计划】17-新员工轮岗培训计划.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈