# Non coherent Symbol Error Rate vs Es/N0

Purpose: Implementing a noncoherent M-ASK modulation ($M=2$) and comparing the results, $\mathrm{SER}$ vs. $E_s/N_0$, to the theoretical formula. The theoretical formula is not based on differential.

The problem statement: Unfortunately, my simulation results are not the same as the theoretical.

Update: I added this line to Matlab code: Sr_norm(i,Sr_norm(i,:)<0)=0; The reason : Theoritcally after an idal diode there is no negative signal. I had an improvement to make the simulated signal close to theoretical curve. Update2: Unfortunately, the curves are fs-dependant. It becomes better since I chose fs = 10. Therefore, it was a failure.

Possible error:

I do not exactly know the source of error. But the problem can emerge from the way I am simulating, therefore, the method of simulation is firstly explained :

The implementation:

2. Based on sampling frequency, fs, and symbol rate (symbol frequency), fsymbol, the number of samples per symbol are calculated.
3. Noise is added to the signal 4.the duration of symbol and starting point is known. Therefore, I just average samples within one symbol to estimate what has been transmitted.
4. Then I just check the estimated mean value is closer to which symbol to interpret it.

@MBaz: I do not see the need for matched filter for my purpose. At the moment in results in simulation (Figure) is better than theory. So I really doubt that using matched filter will give me a result close to theory. Please let me know if I am making a mistake. I am not an expert in this area. Moreover, the formula is coming from: Ke-Lin Du, M. N. S. Swamy-Wireless Communication Systems_ From RF Subsystems to 4G Enabling Technologies (2010), page 194

In my opinion, the problem is how I am adding the noise. I read that the pdf of the symbols with noise should be like this, but the way I am adding the noise does not enforce this type of distribution on my symbols. I checked the histogram of my noisy symbols and the first symbol's distribution is not Rayleigh. Can it be the problem?

[][3]

The code is in this post.

Any idea?

p.s. Although noncoherent seems easier than coherent, I still could not manage to simulate this type of modulation that is close to theory's trace.

clc;
clear all;
format long;

tic;
fs = 1;
fsymbol = 1;
N   = 10000000;      % total Number of symbols
M = 2;         % Number of Symbols
k = log2(M);    % Number of bits per Symbol
rep_nmbr = fs/fsymbol;

Es_N0_dB = 0:2:14;
Es_N0 = 10 .^ (Es_N0_dB/10);

alphabet = [0 1];
St = randsrc(1,N,alphabet);
St1symbol = St;

St_repmat = repmat(St,rep_nmbr,1);
St_repmat_reshape = reshape(St_repmat,1, rep_nmbr*N);

Es = 0.5;%sum(St_repmat_reshape.^2)/(length(St_repmat_reshape)*fsymbol);
%%
for i = 1:length(Es_N0_dB)
N0 = Es./Es_N0(i); % the power spectral density of the noise, n0
pn = N0*fs/2; %the average noise power, pn, of noise having power spectral density „n0?, or sigma_n = N0*fs/2;
n = 1*sqrt(pn)*randn(1,length(St_repmat_reshape));
Sr_norm(i,:) = St_repmat_reshape + n;
Sr_norm(i,Sr_norm(i,:)<0)=0;   % Erasing the values below zeros
end

%%
% Optimum Receiver Structure /or Decision regions comparison
% Decision Structure
Sr = Sr_norm; % No need for deNormalization : *sqrt(Eavg); % deNormalization of received signal
for i = 1:length(Es_N0_dB)
% Decision bounderies
% DM can be fixed or follows the Vopt based on theory
%      DM = 1/2*sqrt(1+2/db2pow(Es_N0_dB(i)));
DM = 0.5;
Sr1=reshape(squeeze(Sr(i,:)),rep_nmbr,N);
Sr_mean(i,:) = mean(Sr1,1);

%     figure;
%     h1 = histogram(Sr_mean(i,St1symbol==1),200);
%     figure;
%     h2 = histogram(Sr_mean(i,St1symbol==0),200);

So_I(find(real(Sr_mean(i,:)) < DM(1)))           = alphabet(1);
if (length(DM) > 1)
for k = 2:length(DM)
So_I(find((real(Sr_mean(i,:)) >  DM(k-1))&(real(Sr_mean(i,:)) < DM(k))))  = alphabet(k);
end
end
So_I(find(real(Sr_mean(i,:)) > DM(length(DM))))  = alphabet(length(alphabet));
So(i,:) = So_I;

Pe2(i) = symerr(St1symbol,So(i,:))/(N);
Pe2_analytic(i) = 1/2*(exp(-db2pow(Es_N0_dB(i))/2)+qfunc(sqrt(db2pow(Es_N0_dB(i)))));  %analytical result
end
'M=2  Simulation Completed'         % display in command window
Processing_Time = toc
%%

figure;
semilogy(Es_N0_dB, Pe2, '-*', Es_N0_dB, Pe2_analytic,'-o');
title('Pe: M-ASK, Analytical and Symulation result');
legend('M=2(simulation)', 'M=2(Analytic)');
xlabel('Es/N0 [dB]');
ylabel('Symbol Error Rate (SER)');

• Your code is a bit hard to follow. Why do you define Eb_N0 but then re-define it? Why do you subtract 10*log10(k) from Eb_N0? Why do you multiply sigma_n by fs? Why do you have two identical variables sigma_n and pn? Please try to simplify your code, and add comments explaining what it's doing. – MBaz Mar 3 '17 at 15:11
• The Es_N0 and Eb_N0 are different. – NightElf Mar 3 '17 at 17:00
• The Es_N0 and Eb_N0 are different. Es_N0 is the energy symbol per N0. Eb_n0 is the energy bit per N0. Finally, i used Es_n0, because of the theoretical formula that I found. Sigma_n is redundant, I will remove it when I access my pc. – NightElf Mar 3 '17 at 17:10
• I double-checked but still managed to confuse Eb with Es, sorry about that... More questions: where do you do matched filtering, and where did you obtain the formula for the error rate? I don't think I had ever seen it. – MBaz Mar 3 '17 at 17:37
• This question asks why a MATLAB program is not giving "the right answer" without specifying what the OP thinks the right answer is. It would appear that there is considerable confusion in the OP's mind about the system since $M$-ASK with $M=2$ is binary ASK and so there is no distinction between $E_b$ and $E_s$. Furthermore, noncoherent 2-ASK generally uses differential encoding at the transmitter and differentially coherent demodulation at the receiver, and I don't see where this is accounted for in the program. I vote to close this question as off-topic. – Dilip Sarwate Mar 4 '17 at 4:05

I also had trouble following the code but the curves look very much like the expected difference between coherent and no-coherent ASK. I suspect that you are not modeling the noise as a complex AWGN process and therefore emulating a coherent system, which is emulating what would happen if you were in complete synchronization with the transmitter's carrier. If you implement the noise as a complex AWGN signal (since the simulation is all done at baseband, which makes sense), and then use the envelope (magnitude) only of the signal to make your binary decision, you should get the analytic result as shown. (If those are done as indicated, then it would suggest the manner in which signal or noise is measured is in error).

I can also provide insight into the Rayleigh and Rician distributions as drawn, which I believe to be correct for the case of Non-Coherent ASK:

The amplitude of a complex (key word there) Gaussian distributed noise process with zero mean will have a Rayleigh distribution. The amplitude of the same process with a non-zero mean will have a Ricean distribution. If the demodulation process is to detect the signal amplitude, and then make a decision, the histograms as shown are correct for establishing the expected error probability. This is consistent with Non-Coherent ASK, as in that appraoch we specifically demodulate by measuring (detecting) the amplitude of the envelope of our modulated waveform. This is in contrast to Corerent ASK which implies we have a local carrier that has be synchronized with the transmitter. In that approach demodulation is done with a product multiplier following an integration over a symbol period followed by a detector. This latter approach is more complicated but would have an improved bit error rate vs SNR. At higher SNR levels, the difference is slightly less than one dB.

To confirm the histograms measured, check that the noise being simulated is indeed complex AWGN, and make sure you are taking the histogram of the amplitude metric for the signal.

I am a big fan of this app note by HP http://www.ab4oj.com/test/docs/5966-4008E.pdf which is specific to measuring noise with a spectrum analyzer, but give a good treatment on the noise processes involved related to this. Below is one graphic from that app note that provides intuitive insight into why we end up with a Rayleigh distribution. I will paraphrase their explanation in that the upper plot is showing samples of a complex white Gaussian noise process, and the radial grid corresponds to regions of constant amplitude. The histogram is the number of samples that appear in between each radial grid. As you approach the origin, the area becomes increasingly smaller and hence the histogram also approaches zero.

• Thanks a lot! It works. It triggers some questions. The only problem is that my results are dependent on "samples per symbol". I want my results to be independent of that parameter. I will make a post and post the figures. – NightElf Mar 9 '17 at 21:52
• Super- See my comments in your post above, was concerned that you were zeroing the negative samples which is not representative of what a diode would do to your pass-band signal. (And of course you should be modelling baseband not passband): To model the "diode" at baseband you want a block that will return the envelope of the signal, which is simply the magnitude (independent of phase). That is the "non-coherent" part of your receiver. – Dan Boschen Mar 9 '17 at 21:53
• Regarding your comment I think it is better phrased as being dependent on the time per symbol. (As it is really the time duration, independent of sampling rate). That said the SNR metric is normalized to be dB-Hz, and then becomes independent of the duration of each symbol. – Dan Boschen Mar 9 '17 at 21:57
• @DanBoschen Thanks for the link to that app note -- that's a nice way to visualize the Rayleigh distribution. HP app notes are a treasure trove of practical information. – MBaz Mar 10 '17 at 3:12
• @MBaz Yes agreed! What was also very useful and interesting to me in this same app note is the expected under estimate (of -1.05 dB) if using the magnitudes to estimate power. (square of the average instead of average of the squares) – Dan Boschen Mar 10 '17 at 19:20

I'll explain the way I would approach this problem. I'm basically following Blahut's "Digital Transmission of Information".

Let $\lbrace s_k(t)=s(t-kT_p)\rbrace,\,k\in\mathbb{N}$, be a set of orthonormal pulses. Let $\mathcal{A}=\lbrace 0,1 \rbrace$, and $a_k \in \mathcal{A}$. The pulse rate is $R_p=1/T_p$. Then the 2-ASK (or, more accurately, OOK) signal can be written as $$v(t)=\left[\sum_k a_k s_k(t)\right]\cos(2\pi f_ct+\phi),$$ where the phase is relative to that of the local oscillator in the receiver. Ignoring noise, the complex baseband signal after quadrature demodulation is $$\left[\sum_k a_ks_k(t)\right]\cos\phi + j\left[ \sum_k a_ks_k(t)\right]\sin\phi.$$ After matched filtering, the signal is $$u(t)=\left[\sum_k a_kr_k(t)\right]\cos\phi + j\left[ \sum_k a_kr_k(t)\right]\sin\phi.$$ Since the pulses are orthonormal, then $$u(kTp) = a_k\cos\phi+ja_k\sin\phi,$$ and $$|u(kT_p)|=|a_k|.$$

I would start the simulation right after the matched filter. At that point, I know that the signal to noise ratio is $E_b/N_0=0.5/N_0$. So,

A = [0,1];                    % constellation
EbN0_dB = 6:12;               % SNR in dB
EbN0 = 10.^(EbN0_dB./10);
BER = zeros(1,length(EbN0));  % preallocate BER
nbit = 1e6;                   % how many symbols to simulate
Eb = 0.5;                     % average bit energy
thr = 0.5;                    % decision threshold

idx = 1;
for snr = EbN0
errs = 0;
n_std = sqrt(Eb/(2*snr));   % noise std dev
for sym = 1:nbit
a = A(randi(2));         % pick a symbol
phi = 2*pi*rand();       % random phase
ni = n_std*randn();      % in-phase noise
nq = n_std*randn();      % quadrature noise
ri = a*cos(phi)+ni;      % in-phase matched filter output
rq = a*sin(phi)+nq;      % quad matched filter output
u = sqrt(ri*ri + rq*rq); % magnitude
if (a==1 && u<thr) || (a==0 && u>thr)
errs = errs + 1;     % error found
end
end
BER(idx) = errs/nbit;    % store BER
idx = idx + 1;
end

% plot
Pb = 0.5*exp(-0.5*EbN0)+qfunc(sqrt(EbN0));  % Theoretical Pb (approx)
semilogy(EbN0_dB,BER,'o-',EbN0_dB,Pb,'x-');
legend('Simulation', 'Theory');
grid on;


With this code I get this result: