16-QAM , how to modify this code for 16-QAM, I have BPSK and QPSK Modulation,

2 views (last 30 days)
%16-QAM , how to modify this code for 16-QAM, I have BPSK and QPSK Modulation, % Please Help me in this issue what to write in the place of Question Marks. % email: shiinexaaji@gmail.com
function [bit_sequence] = symbol2bit(symbol_sequence); % Calculates bit_sequence from the symbol_sequence depending % on the modulation type
global signal;
switch signal.modulation_type
case 'BPSK'
bit_sequence = symbol_sequence;
case 'QPSK'
bit_sequence = [real(symbol_sequence), imag(symbol_sequence)];
case '16-QAM'
??????????????????????
function [symbol_sequence] = bit2symbol(bit_sequence) % Calculates symbol_sequence from the bit_sequence depending on % the modulation type
global signal;
switch signal.modulation_type
case 'BPSK'
symbol_sequence = bit_sequence;
case 'QPSK'
symbol_sequence = bit_sequence(1:signal.nr_of_symbols) + j*...
bit_sequence(signal.nr_of_symbols + 1 : signal.nr_of_bits);
case '16-QAM'
????????????????????????????
function y = ber2snr(x); % Calculates the SNR of the channel % % The SNR of the channel can be estimated/calculated when the % BER of the channel is known.
global signal;
switch signal.modulation_type
case 'QPSK'
y = qinv(x) .^ 2;
case 'BPSK'
y = qinv(x) .^ 2 / 2;
case '16-QAM'
???????????????????
otherwise
error(['Modulation-type unknown: ', signal.modulation_type])
end
function [y] = ber(snr, modulation_type, fading_type); % Calculates the BER(SNR) depending on the modulation-type and % the fading-type
switch fading_type
case 'Rayleigh'
switch modulation_type
case 'BPSK'
y = (1 - sqrt(snr ./ (1 + snr))) / 2;
case 'QPSK'
y = (1 - sqrt(snr ./ (1 / 2 + snr))) / 2;
case '16-QAM'
???????????????????????
otherwise
error(['Modulation-type unknown: ', modulation_type])
end
case 'no'
switch modulation_type
case 'BPSK'
y = q(sqrt(2 * snr));
case 'QPSK'
y = q(sqrt(snr));
case '16-QAM'
????????????????
otherwise
error(['Modulation-type unknown: ', modulation_type])
end
otherwise
error(['Fading-type unknown: ', fading_type])
end
function y = snr2ber(x) % Calculates the BER of the channel
global signal;
switch signal.modulation_type
case 'QPSK'
y = q(sqrt(x));
case 'BPSK'
y = q(sqrt(2 * x));
case '16-QAM'
??????????????????
otherwise
error(['Modulation-type unknown: ', signal.modulation_type])
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!