# Bpsk demodulator implementation

For a project I'm trying to implement a BPSK demodulator on some random wave files, I'm getting a few difficulties:

1. How do I know my bit rate, i.e. how many bits each 'real data bit' I'm having.
2. How can I figure out the size of my real data.
3. I don't know exactly the corner frequency $f_c$, is it OK for me to estimate it for the carrier wave?
• I suggest getting the book "Software Receiver Design" by Johnson, Sethares and Klein. It has the answers you need.
– MBaz
Jun 14 '18 at 13:13

You want to take a wav file, run it through a BPSK modulator and I'm guessing (from your #3) to plot some waveform or something. So you should find a wav file like handel.mat which is built into MATLAB, and convert it to binary. This may require some decisions like how many bits you choose to represent each sample if its not already something you can work with.

All a modulator is doing is mapping bits to symbols. For BPSK, a single bit gets mapped to a single symbol (Bits 0 --> Symbol -1, Bit 1 --> Symbol +1). So now you have mapped to symbols.

Now to make a plot you can just look at the equations for BPSK modulation and plot for some $$f_c$$ that you choose. Or, what I think you may have meant, is to plot the baseband signal in which case you then take your symbols, upconvert them, and pulse shape them (you'll have to choose some pulse shaping filter, check out rcosdesign() function in MATLAB).

How do I know my bit rate, i.e. how many bits each 'real data bit' I'm having.

I'm not sure I understand what you're saying, but this is one level "above" BPSK demodulation. What BPSK demodulation gives you are bits. full stop – how you interpret these bits, and whether they have channel coding can't be said without very much additional knowledge about the data.

How can I figure out the size of my real data.

see above.

don't know exactly the corner frequency $f_c$, is it OK for me to estimate it for the carrier wave?

Don't know what that means. You'll need some way to estimate the symbol clock. For BPSK, the typical easy-to-teach approach is squaring timing recovery, where you just "collapse" the modulation by squaring the signal, and then look for autocorrelation peaks.

For any digital communication scheme, the knowledge of carrier frequency (or the band it falls into) is a must. I think you meant carrier frequency for corner frequency. If you know this, next thing would be how bandwidth does the signal occupy? You can view the spectrum and get a visual clue of this. The bandwidth is actually determined by your bit rate (same as symbol rate since it is BSPK) and Nyquist filter. Knowledge of these 4 things would make your life easier in implementing the demodulator (receiver). Suppose say you figured out center frequency and bandwidth by visual inspection of spectrum and did the conversion to baseband. You still need to know the symbol rate. Suppose say you know this (though in your question you mentioned you do not know it), you can resample the received iq data to a specific rate, say, 4x the symbol rate = $$4 \times T_s$$. You still need to then know if any pulse shaping was deployed while transmitting. If yes, you need to do match filtering and sample at the peaks to get the symbols. In short, a good understanding of digital communications is recommended.