I'm not comfortable with either of your two equations, in part because you don't define any of the three variables involved, but also because I think there's an easier way to understand $E_b/N_0$ and simulate it.
I think the most important thing to know about $E_b/N_0$ is that it is measured at the matched filter's output. The first consequence of this is that the measurement is done at baseband.
Let's assume that your signal $s(t)$ is linearly modulated, so $$s(t) = \sum_k a_k p(t-kT_p),$$ where $R_p = 1/T_p$ is the baud rate and the information is transmitted by the symbols $a_k$ which are elements of an $M$-PAM constellation with average energy $E_p$. Furthermore, the Nyquist pulse $p(t)$ has unit energy.
Let's assume the system has zero noise. In this case, the output of the matched filter, sampled at rate $R_p$, is equal to $a_k$ and its average energy is $E_p$. Then, the average energy per bit at the matched filter's output is $$E_b = \frac{E_p}{\log_2(M)}.$$
Now let us consider the noise. Assume that the input to the matched filter is $n(t)$, which has power spectral density $N_0/2$. Then the filter's output sampled at rate $R_p$ is a Gaussian random variable with variance $\sigma_n^2 = N_0/2$.
The signal-to-noise ratio is defined as the ratio of the average energy per bit to the average energy of a noise sample: $$\text{SNR} = \frac{E_b}{\sigma_n^2} = \frac{2E_b}{N_0}.$$ You often see the SNR defined instead as $E_b/N_0$; the reason is that, in a quadrature system, the total noise energy in the receiver is $2\sigma_n^2 = N_0$. As long as the definition is made clear, one could use either one.
Let's see how to simulate this. Say you want to simulate 4-PAM at $E_b/N_0 = 10$. First, generate 4-PAM symbols with $E_b=1$, or $E_p = 2$. Then, generate noise with variance $\sigma^2 = N_0/2 = E_b/(2 \times 10) = 1/20$. Assuming Matlab:
% generate 100 random a_k
a = 2*(randi([0,3],1,100)-1.5);
% scale them so that Ep=2, Eb=1
a = a*sqrt(2/5);
% Noise has N0 = 1/10, so N0/2 = sigma2 = 1/20
n = sqrt(1/20)*randn(1,100);
% matched filter's output:
y = a + n;
Now y
has $E_b/N_0 = 10$.
Note that extending this to quadrature modulation is trivial: just think of the quadrature system as two parallel PAM systems, each with noise variance $N_0/2$.
I realize that I have only indirectly answered your question, but I hope this is still useful.