A Few Modulations

Version (41 KB) by Jared
ASK, BPSK, FSK and QPSK modulations done by hand.
Updated 5 Sep 2013

View License

A while ago, a good friend of mine took a comms class in grad school that involved MATLAB. He's a computer scientist with a C background, so I helped him out with syntax questions and such.

One of his assignments was to implement these four modulations. The professor stressed good syntax and also told the kids to try to vectorize their code. He also had a side-challenge for fewest lines.

I decided to give it a shot as well. After my friend submitted his code, I sent him my solution, which is the content of this File Exchange submission.

There were some things that were difficult for him with MATLAB syntax. He was trying to replicate bits, the way that the comms rectpulse() function would. There are a lot of cool ways to do that type of thing using standard MATLAB syntax. I demonstrated two of them in my code. One involves repmat() and the other involves ones().

Because some of the syntax is a little obscure for some, I tried to document it extensively in the comments... to include some matrices as they are replicated.

The "help" is pretty extensive. You can play around with the options like samples_per_symbol and plotting and so on and so forth. But really, it was an exercise in minimal code. The QPSK code is the most bloated, at 7 lines of functional code. (Excluding argument checking and plotting.) FSK is the shortest at 3 lines.

Also, the dependency report is empty. i.e. this requires no toolboxes.

Cite As

Jared (2024). A Few Modulations (https://www.mathworks.com/matlabcentral/fileexchange/43386-a-few-modulations), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!


Version Published Release Notes