Hi, Is there some easy way to encode and decode QPSK symbols to bits? For exmple 0 -> 00, 1-> 10, 2 -> 01, 3 -> 11. I didn't find any function that does that. Of course one can write a simple function with four if - clauses, but can you do it more elegantly? |
|
bits to symbols and vice versa
Started by ●November 30, 2002
Reply by ●December 1, 20022002-12-01
dec2bin(number,2) should result in 00 for 0 01 for 1 10 for 2 11 for 3 if you could find some way to reverse the resulting string u wud get the result u wanted. regards, narayanan --- Toivon Sarastus <> wrote: > Hi, > > Is there some easy way to encode and decode QPSK > symbols to bits? > For exmple 0 -> 00, 1-> 10, 2 -> 01, 3 -> 11. > I didn't find any function that does that. Of course > one can write a simple > function with four if - clauses, but can you do it > more elegantly? > > ===== Narayanan Srinivasan Graduate Student LDCSEE West Virginia University Morgantown, WV 26505 Ph: 1 (304) 293 6925(Off.) 1 (304) 685 2165(Cell) __________________________________________________ |
Reply by ●December 1, 20022002-12-01
If you have communication toolbox, check the functions dmodce and modmap. The mapping of indices to bits, as you required, you can use a look-up table (a vector). For example, we can have bits=[0 2 1 3]. Then for an input index in_phase (0 to 3), bits(in_phase) (when converted to binary), is the decoded bits. You can use the same way for encoding. Another way to deal with multiple it-clauses is the switch-clause. You can check it out with helps. Hope this helps, Feng -----Original Message----- From: Toivon Sarastus [mailto:] Sent: Saturday, November 30, 2002 2:23 PM To: Subject: [matlab] bits to symbols and vice versa Hi, Is there some easy way to encode and decode QPSK symbols to bits? For exmple 0 -> 00, 1-> 10, 2 -> 01, 3 -> 11. I didn't find any function that does that. Of course one can write a simple function with four if - clauses, but can you do it more elegantly? <http://rd.yahoo.com/M#4081.2711418.4084139.1925585/D=egroupweb/S050833 76:HM/A28027/R=0/*http://ad.doubleclick.net/clk;4870030;7586687;u?http:// www.ameriquestmortgage.com/welcome.html?ad=Yahoo01 _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: To Post: To Leave: Archives: http://www.yahoogroups.com/group/matlab More DSP-Related Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/> . |