Simulating Pulse Amplitude Modulation(PAM) on a Mac

One can use the IT++ library:

This code is actually cross-platform because IT++ is cross-platform.

//Chinmoy Gavini.

//Code licensed under the GPLv2

//Update: I have tested the following code. It works. Note that the binary string below must not have spaces or endlines(of course, your text editor will word-wrap the content–that is fine).

//However, the usual disclaimers in GPLv2 apply to this code.

#include <itpp/itbase.h>
#include <itpp/comm/modulator.h>

int main()
PAM p(4); //We want 4-PAM
vec output; //modulated thing
bvec demodded_out;
bvec input = “0100100001100101011011000



//Binary representation of Hello World!

//The following line of code simulates the transmitter end.

//In a realistic simulation, we would have code to add pulse shaping and noise where this comment is

//The following simulates the receiver end.

if(input == demodded_out)


cout<<“Hello World”<<endl;




cout<<“Big Bad World”<<endl;


return 0;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s