-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyplot3.m
More file actions
26 lines (23 loc) · 710 Bytes
/
myplot3.m
File metadata and controls
26 lines (23 loc) · 710 Bytes
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
% plot the BER-SNR curve of SP & Layered-SP
% load ber data
SP = load('BER/SP.mat');
LSP = load('BER/LSP.mat');
max_len = max([length(SP.ber_res) length(LSP.ber_res)]);
% padding 0 to the same length
SP.ber_res = [SP.ber_res zeros(1,max_len-length(SP.ber_res))];
LSP.ber_res = [LSP.ber_res zeros(1,max_len-length(LSP.ber_res))];
% plot BER - SNR
snrdb = (0:0.2:(0.2*max_len-0.2));
figure;
plot(snrdb, LSP.ber_res, '--', 'color', 'r', 'LineWidth', 2);
hold on;
plot(snrdb, SP.ber_res, '--', 'color', 'g', 'LineWidth', 2);
legend('Layered SP', 'SP');
set(gca, 'YScale', 'log')
title('BER - SNR');
ylabel('BER');
xlabel('SNR [dB]');
xlim([0,4])
ylim([10^(-8),1]);
hold off;
saveas(gcf, './figure/myplot3.png')