Skip to content

Instantly share code, notes, and snippets.

View cristeab's full-sized avatar
🎯
Focusing

Bogdan Cristea cristeab

🎯
Focusing
View GitHub Profile
@cristeab
cristeab / mex_qpsk.cpp
Last active September 24, 2020 20:11
Simple function that performs in C++Quadrature Phase Shift Keying (QPSK) modulation using as inputs arrays from MATLAB and returning in MATLAB format the output
#include <itpp/itcomm.h>
#include <itpp/itmex.h>
using namespace itpp;
void mexFunction(int n_output, mxArray *output[], int n_input, const mxArray *input[]) {
  // Check the number of inputs and output arguments
  if(n_output!=1) mexErrMsgTxt("Wrong number of output variables!");
  if(n_input!=1) mexErrMsgTxt("Wrong number of input variables!");
  // Convert input variables to IT++ format
  bvec input_bits = mxArray2bvec(input[0]);
  // - - - - - - - - - Start of routine - - - - - - - - - - - - - -
#!/usr/bin/env python
from pyitpp import itload
from matplotlib.pyplot import *
out = itload('pccc_bersim_awgn.it')
semilogy(out['EbN0_dB'], out['BER'].T, 'o-')
grid()
xlabel('$E_b/N_0 [dB]$')