Exemple #1
0
    def _calcTheoreticalSingleCarrierErrorRate(self, SNR):
        """
        Calculates the theoretical (approximation) error rate of a single
        carrier in the QAM system (QAM has two carriers).

        Parameters
        ----------
        SNR : float | np.ndarray
            Signal-to-noise-value (in dB).

        Returns
        -------
        Psc : float | np.ndarray
            The theoretical single carrier error rate.

        Notes
        -----
        This method is used in the :meth:`calcTheoreticalSER`
        implementation.

        See also
        --------
        calcTheoreticalSER

        """
        snr = dB2Linear(SNR)
        # Probability of error of each carrier in a square QAM
        # $P_{sc} = 2\left(1 - \frac{1}{\sqrt M}\right)Q\left(\sqrt{\frac{3}{M-1}\frac{E_s}{N_0}}\right)$
        sqrtM = np.sqrt(self._M)
        Psc = (2. * (1. - (1. / sqrtM)) *
               qfunc(np.sqrt(snr * 3. / (self._M - 1.))))
        return Psc
Exemple #2
0
    def _calcTheoreticalSingleCarrierErrorRate(self, SNR):
        """
        Calculates the theoretical (approximation) error rate of a single
        carrier in the QAM system (QAM has two carriers).

        Parameters
        ----------
        SNR : float | np.ndarray
            Signal-to-noise-value (in dB).

        Returns
        -------
        Psc : float | np.ndarray
            The theoretical single carrier error rate.

        Notes
        -----
        This method is used in the :meth:`calcTheoreticalSER`
        implementation.

        See also
        --------
        calcTheoreticalSER

        """
        snr = dB2Linear(SNR)
        # Probability of error of each carrier in a square QAM
        # $P_{sc} = 2\left(1 - \frac{1}{\sqrt M}\right)Q\left(\sqrt{\frac{3}{M-1}\frac{E_s}{N_0}}\right)$
        sqrtM = np.sqrt(self._M)
        Psc = (2. * (1. - (1. / sqrtM)) *
               qfunc(np.sqrt(snr * 3. / (self._M - 1.))))
        return Psc
Exemple #3
0
    def calcTheoreticalSER(self, SNR):
        """Calculates the theoretical (approximation) symbol error rate for
        the BPSK scheme.

        Parameters
        ----------
        SNR : float or array like
            Signal-to-noise-value (in dB).

        Returns
        -------
        SER : float or array like
            The theoretical symbol error rate.
        """
        snr = dB2Linear(SNR)
        # $P_b = Q\left(\sqrt{\frac{2E_b}{N_0}}\right)$
        # Alternative formula (same result)
        # $P_b = \frac{1}{2}erfc \left ( \sqrt{\frac{E_b}{N_0}} \right )$
        ser = qfunc(np.sqrt(2 * snr))
        return ser
Exemple #4
0
    def calcTheoreticalSER(self, SNR):
        """
        Calculates the theoretical (approximation) symbol error rate for
        the BPSK scheme.

        Parameters
        ----------
        SNR : float | np.ndarray
            Signal-to-noise-value (in dB).

        Returns
        -------
        SER : float | np.ndarray
            The theoretical symbol error rate.
        """
        snr = dB2Linear(SNR)
        # $P_b = Q\left(\sqrt{\frac{2E_b}{N_0}}\right)$
        # Alternative formula (same result)
        # $P_b = \frac{1}{2}erfc \left ( \sqrt{\frac{E_b}{N_0}} \right )$
        ser = qfunc(np.sqrt(2 * snr))
        return ser
Exemple #5
0
    def calcTheoreticalSER(self, SNR):
        """Calculates the theoretical (approximation for high M and high
        SNR) symbol error rate for the M-PSK scheme.

        Parameters
        ----------
        SNR : float | np.ndarray
            Signal-to-noise-value (in dB).

        Returns
        -------
        SER : float | np.ndarray
            The theoretical symbol error rate.
        """
        snr = dB2Linear(SNR)

        # $P_s \approx 2Q\left(\sqrt{2\gamma_s}\sin\frac{\pi}{M}\right)$
        # Alternative formula (same result)
        # $P_s = erfc \left ( \sqrt{\gamma_s} \sin(\frac{\pi}{M})  \right )$
        ser = 2. * qfunc(np.sqrt(2. * snr) * math.sin(PI / self._M))
        return ser
Exemple #6
0
    def calcTheoreticalSER(self, SNR):
        """Calculates the theoretical (approximation for high M and high
        SNR) symbol error rate for the M-PSK scheme.

        Parameters
        ----------
        SNR : float | np.ndarray
            Signal-to-noise-value (in dB).

        Returns
        -------
        SER : float | np.ndarray
            The theoretical symbol error rate.
        """
        snr = dB2Linear(SNR)

        # $P_s \approx 2Q\left(\sqrt{2\gamma_s}\sin\frac{\pi}{M}\right)$
        # Alternative formula (same result)
        # $P_s = erfc \left ( \sqrt{\gamma_s} \sin(\frac{\pi}{M})  \right )$
        ser = 2. * qfunc(np.sqrt(2. * snr) * math.sin(PI / self._M))
        return ser
Exemple #7
0
 def test_qfunc(self):
     self.assertAlmostEqual(misc.qfunc(0.0), 0.5)
     self.assertAlmostEqual(misc.qfunc(1.0), 0.158655254, 9)
     self.assertAlmostEqual(misc.qfunc(3.0), 0.001349898, 9)
 def test_qfunc(self):
     self.assertAlmostEqual(misc.qfunc(0.0), 0.5)
     self.assertAlmostEqual(misc.qfunc(1.0), 0.158655254, 9)
     self.assertAlmostEqual(misc.qfunc(3.0), 0.001349898, 9)