Maximal Ratio Combining Example in Matlab

In the old days, communication between a transmitter and receiver was simple. The transmitter sent out a single signal through one antenna, which eventually arrived at a single antenna at the receiver, probably along with a little noise.

The Good Old Days
The Good Old Days

But we just couldn’t be satisfied with that, could we? We got mad when our cellphones dropped calls. We noticed, curiously, that we could often improve reception during a call by just taking a couple steps in one direction, and maybe turning 90 or 180 degrees. We began to start asking questions…

    Harry: “What if we put 2, 3, … I dunno, 8 antennas on the receiver separated by a little space? Maybe by luck if the signal is arriving weakly at one antenna, it might be arriving strongly at another?”

    Barry: “Yeah, I like that! If it’s zigging at one antenna maybe it’s zagging at another. We could just program the receiver to pick and use the strongest signal.”

    Jerry: “But what about the 7 other weaker signals? There’s real information there and you’re just going to throw it away? I say we average all the signals!”

    Larry: “Jerry, if you’re eating a delicious lobster salad and I come along and pour some brussel sprout purée all over it, what are you tasting now? Only godawful brussel sprouts! Good information + bad information = bad information. There must be some way to blend the signals SMARTLY…”

I was pondering this question back in the early 2000’s. As luck would have it, I attended a conference where many papers had to handle this very issue. Only… all the presenters seemed to know what the answer was, and it was called maximal ratio combining (MRC).

Most of their papers briefly presented how to do it. Have a look!

B. Holter, G. Oien, "The optimal weights of a maximum ratio combiner using an eigenfilter approach," Proc. 5th IEEE Nordic Signal Processing Symposium, Hurtigruten, Norway, Oct. 2002.
B. Holter and G. Oien, “The Optimal Weights of a Maximum Ratio Combiner Using an Eigenfilter Approach,” Proc. 5th IEEE Nordic Signal Processing Symposium, Oct. 2002.

Now I’m sure the Norwegians and everybody else who authored such papers thought they’d made it all crystal clear. But when I see hieroglyphics like this, my brain just shuts down. There’s only one thing for it and that’s the trusty old technique of Proof by Matlab. It goes like this.

1. Attempt to read IEEE paper. Stop in paragraph 3 unable to see through tears.
2. Open paper again. Try to just see what variables they're working with and how (+, -, ×, ÷)
3. Think, if I had these variables to work with, what would I do? Might they be doing something like that?
4. Try ideas for hours in Matlab. Eventually get same performance as shown in paper.

And of course the work would be wasted if it we don’t also do Professional Reputation Enhancement by Matlab. This involves first academifying your code by replacing for-loops with matrix operations and trying to do as much as possible on each single line via nested parentheses, then forwarding it and a PDF of the paper on to the boss and colleagues – describing the technique as “this simple idea I stumbled across” that you “quickly coded up” and …yawn… yeah, it works…

I’d like to think I’m more mature now so let me just give you the quick download on maximal ratio combining.

1. MRC is just a weighted average of the multiple copies
2. The weight for each is the SNR of the channel it came from
3. Not SNR in dB! Just plain ol' unitless SNR
4. The SNR of the resulting average is the sum of all the channel SNRs
5. Not SNR in dB! Just plain ol' unitless SNR

For (4) to be true, the noise in each of the channels has to be independent. If the noise is correlated… well, I’m sure there’s a paper out there that’ll show you what to do, and I bet it involves some sinister autocovariance matrix (in fact, that might be the R in the paper I sampled above).

While I won’t touch that one with a 10 ft. pole, I will let you steal my code for normal MRC below!

Matlab code: mrc_example.m

One thought on “Maximal Ratio Combining Example in Matlab”

Leave a Reply

Your email address will not be published.