📄 pr2_48.m
字号:
%Problem 2.48;
%Experimental estimation of error probability for uncoded and orthogonally
%encoded m-ary transmission;
clear all; close all;
Sb=ones(1,64); %bit pulse oversampled 64 times;
Nb=input('input message number (within [0,63])='); Mes=-2*bitget(Nb,1:6)+1; %inputs message number and converts it to +1, -1 vector;
Su=kron(Mes,Sb); %oversampled uncoded signal;
subplot(221); plot(Su); ylim([-1.2 1.2]); xlim([1 384]); grid; %plotting uncoded signal;
q=0.25; %set per sample input SNR
Y=kron(ones(1000,1),Su)+normrnd(0,1/q,[1000 384]); %matrix of 1000 observations, sample standard deviation is 1/q;
subplot(223); plot(Y(1:5,:)'); xlim([1 384]); ylim([-4/q 4/q]); grid; %plotting 5 selected observations;
Dem=sign(Y*kron(eye(6),Sb')); %demodulate 1000 observations: each row of the observation matrix is multiplied by 384*6 matrix
%giving 1000*6 matrix of bit correlator outputs for each successive of 6 bits, then decision on every bit is done by taking a sign;
Nd=((1-Dem)/2)*[1 2 4 8 16 32]'; %bit estimations produce estimated number of received message;
Er1=0.001*sum(Nd~=Nb); %calculates experimental error probability, uncoded;
H=hadamard(64); %Hadamard matrix of 64th order;
Hs=kron(H,ones(1,6)); %oversampled orthogonal signals matrix;
Nb=((-Mes+1)/2)*[1 2 4 8 16 32]'+1; Su=Hs(Nb,:); %transmitted orthogonal signal corresponding to the same message as before;
subplot(222); plot(Su); ylim([-1.2 1.2]); xlim([1 384]); grid; %plotting transmitted signal;
Y=kron(ones(1000,1),Su)+normrnd(0,1/q,[1000 384]); %matrix of 1000 observations;
subplot(224); plot(Y(1:5,:)'); grid; xlim([1 384]); ylim([-4/q 4/q]); %plotting 5 selected observations;
[L,Nd]=max(Hs*Y'); %demodulates by correlation with all rows of Hadamard matrix and selecting biggest correlation;
Er2=0.001*sum(Nd~=Nb); %calculates experimental orthogonal signalling error probability;
fprintf('\n');
disp(' bit SNR PrErUnc PrErOrt');
disp([8*q,Er1,Er2]); %bit SNR is 8 times q, since there are 64 samples per bit.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -