# How to derive the error probability for pulse position modulation in digital communication?

I am trying to build a simulation on MATLAB for PPM transmission through AWGN channel. I have a function wrapping the transmitter, channel and receiver that takes a SNR value as input. My simulation program does multiple iterations for different SNR values and plot the bit error probability (BER) as a function of SNR (in dB). My results are extremly low and I find it a bit surprising:

To compare simulation to the theory I decided to derive the bit error probability for my modulation scheme (2-PPM where the basis functions are orthogonal). According to this paper, the probability of error for M-PPM can be written as: $$P_{err}\approx Q \left ( \frac{s}{\sqrt{2N_{0}}} \right )$$ Where: $$s=P\sqrt{\frac{L_{PPM}log_{2}(L_{PPM})}{R_{b}}}$$ Which I modified with my parameters ($$L_{PPM}=2$$, $$P=\sqrt{E_{b}}$$, and $$R_{b}=10^6$$) to get it as function of $$\frac{E_{b}}{N_{0}}$$ like this: $$P_{err}\approx Q \left ( \frac{1}{\sqrt{R_{b}}} \sqrt{\frac{E_{b}}{N_{0}}} \right )$$ This, when plotted with MATLAB for SNR values frome -40 dB to 10 dB looks like this:

Also, in my course, I can find this formula for orthogonal signal:

Given that my basis functions are also orthogonal, which formula should I use ?

I suspect the noise generation in my simulation to be incorrect and I think that I don't really understand how it works. Here is my code for the AWGN channel:

% AWGN channel
Ps = mean(abs(x).^2);
SNR_lin = 10^(SNR/10);
N0 = Ps / SNR_lin;
n = sqrt(N0/2)*randn(size(t))+1i*randn(size(t));
y = x + n;


Where x is the transmitted signal and the SNR is given in dB in the parameters.