# HW3S - ps3_1b.m ps3_1c.m ps3_3a.m ps3_3b.m clear all close...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ps3_1b.m , ps3_1c.m , ps3_3a.m , ps3_3b.m clear all; close all; % Include pre-detection integration of n-pulses % Number of realizations N=1e6; % Number of pulses to integrate na=[1 10]; % Signal to noise ratio (dB) for each value of n % Student formula: put correct values of SNR1 and SNR2 below SNRa=[SNR1 SNR2]; % Std deviation of instrument noise sigma_g=2; for nn=1:length(na) n=na(nn); SNR=SNRa(nn); % Instrument noise (complex I/Q form Orig_Noise=(randn(N,n)+j*randn(N,n))*sigma_g; % Pre-detection integration Noise=mean(Orig_Noise,2); % Take the absolute value (envelope) Env_Noise=abs(Noise); % First figure out mean and standard deviation of Monte Carlo noise n_mu=mean(Env_Noise); n_std=std(Env_Noise); % Define threshold in terms of standard devations from mean thresh1=-10:0.1:10; % Scale to true values thresh=n_mu+thresh1*n_std; % Create signal + noise array and take envelope A=10.^(SNR/20)*sqrt(2)*sigma_g; phi=rand(N,1)*2*pi; Signal=A*(cos(phi)+j*sin(phi)); Env_SNoise=abs(Signal+Noise); % Estimate the probability of detection and false alarm % Loop over threshold and find the number of samples that exceed the threshold for i=1:length(thresh) t=thresh(i); I=find(Env_SNoise>t); mc_pd(i)=length(I)/N; I=find(Env_Noise>t); mc_pfa(i)=length(I)/N; end % Plot a receiver operating characteristic curve figure(1) set(gca,'Fontsize',12) if (nn==1) loglog(mc_pfa,1-mc_pd,'-','markersize',10,'linewidth',2) else loglog(mc_pfa,1-mc_pd,'rx','markersize',10,'linewidth',2) end hold on end grid on xlabel('P_{fa}') ylabel('1-P_{d}') legend(sprintf('n=%d',na(1)),sprintf('n=%d',na(2))) axis([1e-6 1 1e-6 1]) clear all; close all; % Include post-detection integration of n-pulses % Number of realizations N=1e6; % Number of pulses to integrate na=[1 10]; % Signal to noise ratio (dB) for each value of n % Student formula: put correct values of SNR1 and SNR2 below SNRa=[SNR1 SNR2]; % Std deviation of instrument noise...
View Full Document

## This note was uploaded on 10/28/2009 for the course ECE 714 taught by Professor Johnson,j during the Spring '08 term at Ohio State.

### Page1 / 7

HW3S - ps3_1b.m ps3_1c.m ps3_3a.m ps3_3b.m clear all close...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online