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:
- Random symbols are made
- Based on sampling frequency,
fs
, and symbol rate (symbol frequency),fsymbol
, the number of samples per symbol are calculated. - 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.
- 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)');
Eb_N0
but then re-define it? Why do you subtract10*log10(k)
fromEb_N0
? Why do you multiplysigma_n
byfs
? Why do you have two identical variablessigma_n
andpn
? Please try to simplify your code, and add comments explaining what it's doing. $\endgroup$Eb
withEs
, 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. $\endgroup$