RENEWLab  1.1.0
RENEW project
mod_demod.m File Reference

Functions

AWGN channel (1) or fading(0) % random bits mybits
 
 figure (cf)
 
 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')
 
 legend (hlegs, 'Tx', 'Rx', 'Fontsize', 16)
 
 fprintf ("Symbol Error Rate = %12.4e\t Bit Error Rate = %12.4e\n", sym_err, bit_err)
 

Variables

Author(s) clear
 
 MOD_ORDER = 16
 
Modulation order N = 1000
 
 nbits = N * log2(MOD_ORDER)
 
number of bits snr = 15
 
 n_ant = 1
 
number of antennas awgn = 1
 
Plot Tx constellation cf = 0
 
 clf
 
 ln_clr = [0.25, 0.25, 0.25]
 
grid on
 
end axis square
 
hold off
 
 tx_clr = [0, 0.4470, 0.7410]
 
 rx_clr = [0.8500, 0.3250, 0.0980]
 
 hleg2 = plot(syms(:),'*','MarkerSize',16, 'LineWidth',2, 'Color', tx_clr)
 
else hleg1 = plot(rx_syms(:), 0,'o','MarkerSize',3, 'Color', rx_clr)
 
end hlegs = [hleg1 hleg2]
 
Do your selves
 
 bit_err = mean(mybits ~= bits)
 

Function Documentation

◆ axis()

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

◆ channel()

AWGN channel ( )

◆ figure()

figure ( cf  )

◆ fprintf()

fprintf ( )

◆ legend()

legend ( hlegs  ,
'Tx ,
'Rx'  ,
'Fontsize'  ,
16   
)

◆ line()

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

◆ plot()

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

◆ title()

title ( 'Constellation'  )

◆ xlabel()

xlabel ( 'Inphase'  )

◆ ylabel()

ylabel ( 'Quadrature'  )

Variable Documentation

◆ awgn

number of antennas awgn = 1

◆ bit_err

bit_err = mean(mybits ~= bits)

◆ cf

Plot Rx constellation cf = 0

◆ clear

Author (s) clear

◆ clf

clf

◆ hleg1

else hleg1 = plot(rx_syms(:), 0,'o','MarkerSize',3, 'Color', rx_clr)

◆ hleg2

hleg2 = plot(syms(:),'*','MarkerSize',16, 'LineWidth',2, 'Color', tx_clr)

◆ hlegs

end hlegs = [hleg1 hleg2]

◆ ln_clr

ln_clr = [0.25, 0.25, 0.25]

◆ MOD_ORDER

if MOD_ORDER = 16

◆ N

Modulation order N = 1000

◆ n_ant

n_ant = 1

◆ nbits

nbits = N * log2(MOD_ORDER)

◆ off

hold off

◆ on

hold on

◆ rx_clr

rx_clr = [0.8500, 0.3250, 0.0980]

◆ selves

Do your selves

◆ snr

number of bits snr = 15

◆ square

axis square

◆ tx_clr

tx_clr = [0, 0.4470, 0.7410]