RENEWLab  1.1.0
RENEW project
bits2syms.m File Reference

Functions

if mod (nbits, sym_bits) ~=0error("Length of bit stream has to be divisible by sym_bits")
 
1/sqrt(2 modvec_bpsk ()
 
mod_fcn_16qam, data arrayfun ()
 
otherwise fprintf ('Invalid MOD_ORDER(%d)! Must be in[2, 4, 16, 64]\n', MOD_ORDER)
 
end Plot constellation if do_plot figure (1) ln_clr
 
 line ([-1.5, 1.5], [0 0], 'LineStyle', '-', 'Color', ln_clr, 'LineWidth', 1)
 
else plot (syms(:), 0,' *', 'MarkerSize', 16, 'LineWidth', 2)
 
 axis (1.5 *[-1 1 -1 1])
 
 xlabel ('Inphase')
 
 ylabel ('Quadrature')
 
 title ('Constellation')
 

Variables

Author(s) nbits = length(bitstream)
 
Do yourselves
 
end bits to integer numbers bit_mat = reshape(bitstream, sym_bits, [])'
 
 data = bi2de(bit_mat, 'left-msb')
 
 modvec_16qam = (1/sqrt(10)) .* [-3 -1 +3 +1]
 
 modvec_64qam = (1/sqrt(42)) .* [-7 -5 -1 -3 +7 +5 +1 +3]
 
 mod_fcn_bpsk = @(x) complex(modvec_bpsk(1+x),0)
 
 mod_fcn_qpsk = @(x) complex(modvec_bpsk(1+bitshift(x, -1)), modvec_bpsk(1+mod(x, 2)))
 
 mod_fcn_16qam = @(x) complex(modvec_16qam(1+bitshift(x, -2)), modvec_16qam(1+mod(x,4)))
 
 mod_fcn_64qam = @(x) complex(modvec_64qam(1+bitshift(x, -3)), modvec_64qam(1+mod(x,8)))
 
Map the data values on to complex symbols switch MOD_ORDER case BPSK syms = arrayfun(mod_fcn_bpsk, data)
 
 return
 
grid on
 
if MOD_ORDER
 
end axis square
 
hold off
 

Function Documentation

◆ arrayfun()

mod_fcn_16qam, data arrayfun ( )
virtual

◆ axis()

axis ( 1.5 *  [-1 1 -1 1])

◆ figure()

end Plot constellation if do_plot figure ( )

◆ fprintf()

otherwise fprintf ( 'Invalid MOD_ORDER(%d)! Must be in\n'  [2, 4, 16, 64],
MOD_ORDER   
)

◆ line()

line ( 'LineStyle'  ,
'-'  ,
'Color'  ,
ln_clr  ,
'LineWidth'  ,
 
)

◆ mod()

if mod ( nbits  ,
sym_bits   
)
pure virtual

◆ modvec_bpsk()

1/sqrt(2 modvec_bpsk ( )
virtual

◆ plot()

else plot ( syms(:)  ,
,
' *'  ,
'MarkerSize'  ,
16  ,
'LineWidth'  ,
 
)

◆ title()

title ( 'Constellation'  )

◆ xlabel()

xlabel ( 'Inphase'  )

◆ ylabel()

ylabel ( 'Quadrature'  )

Variable Documentation

◆ bit_mat

end bits to integer numbers bit_mat = reshape(bitstream, sym_bits, [])'

◆ data

data = bi2de(bit_mat, 'left-msb')

◆ mod_fcn_16qam

mod_fcn_16qam = @(x) complex(modvec_16qam(1+bitshift(x, -2)), modvec_16qam(1+mod(x,4)))

◆ mod_fcn_64qam

mod_fcn_64qam = @(x) complex(modvec_64qam(1+bitshift(x, -3)), modvec_64qam(1+mod(x,8)))

◆ mod_fcn_bpsk

mod_fcn_bpsk = @(x) complex(modvec_bpsk(1+x),0)

◆ mod_fcn_qpsk

mod_fcn_qpsk = @(x) complex(modvec_bpsk(1+bitshift(x, -1)), modvec_bpsk(1+mod(x, 2)))

◆ MOD_ORDER

if MOD_ORDER
Initial value:
= 2
plot(syms(:),'*','MarkerSize',16, 'LineWidth',2)

◆ modvec_16qam

modvec_16qam = (1/sqrt(10)) .* [-3 -1 +3 +1]

◆ modvec_64qam

modvec_64qam = (1/sqrt(42)) .* [-7 -5 -1 -3 +7 +5 +1 +3]

◆ nbits

Author (s) nbits = length(bitstream)

◆ off

hold off

◆ on

hold on

◆ return

return

◆ square

end axis square

◆ syms

case QPSK syms = arrayfun(mod_fcn_bpsk, data)

◆ yourselves

Do yourselves
plot
else plot(syms(:), 0,' *', 'MarkerSize', 16, 'LineWidth', 2)
syms
Map the data values on to complex symbols switch MOD_ORDER case BPSK syms
Definition: bits2syms.m:42