forked from bb16177/OTFS-Simulation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotGraphs.m
More file actions
58 lines (51 loc) · 1.85 KB
/
plotGraphs.m
File metadata and controls
58 lines (51 loc) · 1.85 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function [] = plotGraphs(berOFDM, berCOFDM, berOTFS, berCOTFS, M, numSC, EbNo)
%--------------------------------------------------------------------------
%
% Plots and formats BER graphs of the input BER vectors
%
%--------------------------------------------------------------------------
% Input arguments:
%
% berOFDM OFDM ber vector
% berCOFDM coded-OFDM ber vector
% berOTFS OTFS ber vector
% berCOTFS coded-OFDM ber vector
% M Modulation order
% numSC no. subcarriers used in system
%
%--------------------------------------------------------------------------
% Function returns:
%
% void
%
%--------------------------------------------------------------------------
%
% Author: Bradley Bates
% University of Bristol, UK
% email address: bb16177@bristol.ac.uk
% May 2020
%
% Copyright (c) 2020, Bradley Bates
%
%--------------------------------------------------------------------------
% Set error rates of 0 to a very low value which can be plotted on graph
berCOFDM(~berCOFDM)=1e-12;
berCOTFS(~berCOTFS)=1e-12;
% Plotting
figure
% Plot non-coded results
semilogy(EbNo,berOFDM(:,1),'-g'); %Plot simulated BER w/ OFDM
hold on;
semilogy(EbNo,berOTFS(:,1),'-r'); %Plot simulated BER w/ OTFS
% Plot coded results
semilogy(EbNo,berCOFDM(:,1),'--g'); %Plot simulated BER w/ C-OFDM
semilogy(EbNo,berCOTFS(:,1),'--r'); %Plot simulated BER w/ C-OTFS
% Formatting graph
axis([0 30 0.0005 0.5])
title(['BER for ', num2str(M), '-QAM in Wideband Rayleigh Fading with ', num2str(numSC),' Subcarriers']);
ylabel('Bit Error Rate');
xlabel('EbNo (dB)');
legend('OFDM', 'OTFS','C-OFDM','C-OTFS');
grid on;
hold off;
end