forked from brian09088/NB-IoT-support-for-NTN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modulation.m
29 lines (21 loc) · 816 Bytes
/
Modulation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% This function computes the BER for different types of mod_orders.
% For a given mod_order, mod_order order, and BER specification, it gives the required Eb/NO.
function [EbNo_spec] = Modulation(mod_order , ber_spec)
EbNo = 0:0.01:25;
switch mod_order
case {"OQPSK" ,"oqpsk"}
dataenc = input('Differential encode (diff) or non differential (nondiff): ','s');
BER = berawgn(EbNo, 'oqpsk' ,dataenc) ;
case {"QPSK" ,"qpsk"}
% dataenc = input('Differential encode (diff) or non differential (nondiff): ','s');
% BER = berawgn(EbNo, 'qpsk' ,dataenc) ;
end
EbNo_spec = interp1(BER,EbNo, ber_spec) ;
semilogy (EbNo, BER)
hold on
semilogy (EbNo_spec,ber_spec, 'bp')
legend('BER', 'BER specification')
title ('BER vs Eb/No')
xlabel('Eb/No')
ylabel('BER')
end