⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pr2_50.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem 2.50
%Amplitude measuring; Simulates ML amplitude estimation for an arbitrary
%pulse;

clear all; close all;
S=linspace(0,1,101); S=S/norm(S); %reference signal vector, its energy is normalized to one;
N=length(S); %number of samples;
A=input('A='); SA=A*S; %presetting amplitude from the interval;
fprintf('\n');
subplot(221), 
plot([0:N-1]/N,SA), grid, xlabel('t/T'), ylabel('As(t)'), xlim([0 1.01]), ylim([-0.1 1.2]*max(A*S)), %draws reference signal;
Nobs=1000; %number of observations;
SA=kron(ones(1,Nobs)',SA); %preparing for generating of observations matrix;
q=3; %set reference voltage SNR;
No=normrnd(0,1/q,Nobs,N); %matrix of noise waveforms;
subplot(222), plot([0:0.01:1],No(1:5,:)'), grid, xlabel('t/T'), ylabel('n(t)'), xlim([0 1.01]), %draws 5 selected noise realizations;
Ob=SA+No; %martrix of observation waveforms;
subplot(223); plot([0:0.01:1],Ob(1:5,:)'), grid, xlabel('t/T'), ylabel('y(t)'), xlim([0 1.01]),%draws 5 selected observation waveforms;
z=S*Ob'; %correlations between reference signal and observations;
AE=A*linspace(0,2,51); %vector of candidate amplitudes, used only to plot dependence of z(A)-E(A)/2 on estimate A;
DS=z'*AE-kron(ones(Nobs,1),(AE.^2)/2); % decision statistics;
subplot(224); plot(AE,DS(1:5,:)), grid, xlabel('A'), ylabel('z(A)-E(A)/2'), xlim([0 2*A]) %draws dependency of 5 selected decision statistics on amplitude estimation;
AEO=z; %optimal amplitude estimation;
AvAest=mean(AEO); sigex=std(AEO); %experimental mean and variance of estimate;
disp('    RefSNR     Atrue    AvAest     StdEx     StdTh'); 
disp([q,A,AvAest,sigex,1/q]); %displays reference SNR, true amplitude, averaged estimation, experimental and theoretical standard deviations of estimate of amplitude;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -