summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python/ofdm/plot_ofdm.m
blob: 87eae3a116e0f1ae411e3299c0150143702b46e4 (plain)
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
59
60
61
62
63
64
65
function plot_ofdm(fft_size, occ_tones)

ofdm = read_complex_binary('ofdm_corr_out_c.dat');
ofdm_split = split_vect(ofdm, occ_tones);

fftc = read_complex_binary('fft_out_c.dat');
fftc_split = split_vect(fftc, fft_size);

figure(1)
set(gcf, 'Position', [50 50 1000 600]);

a = size(ofdm_split);
if nargin == 3
    maxcount = count;
    if maxcount > a(1)
        error('plot_ofdm:tolong', 'Requested count size exceeds size of vectors');
    end
else
    maxcount = a(1);
end

for i = 1:20000
    x = ofdm_split(i,:);
    y = fftc_split(i+1,:);
    
    subplot(2,2,1)
    plot(real(x), imag(x), 'bo')
    set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
    axis([-1.5, 1.5, -1.5, 1.5])
    title('I&Q Constellation', 'FontSize', 36);
    xlabel('Inphase', 'FontSize', 32);
    ylabel('Quadrature', 'FontSize', 32);
    
    subplot(2,2,3)
    plot(angle(x*j), 'bo')
    set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
    axis([0, occ_tones, -3.5, 3.5])
    title('Equalized Symbol Angle', 'FontSize', 36);
    xlabel('Bin Number (Occ. Tones)', 'FontSize', 32);
    ylabel('Symbol Angle', 'FontSize', 32);
    
    subplot(2,2,2)
    plot(angle(y*j), 'bo')
    set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
    axis([0, fft_size, -3.5, 3.5]) 
    title('Unequalized Symbol Angle', 'FontSize', 36);
    xlabel('Bin Number (FFT Size)', 'FontSize', 32);
    ylabel('Symbol Angle', 'FontSize', 32);
    
    Y = 20*log10(abs(y) ./ max(abs(y)));
    subplot(2,2,4)
    plot(Y, 'b-')
    set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
    axis([0, fft_size, -50, 1]);
    title('Frequency Domain of Unequalized Rx', 'FontSize', 36);
    xlabel('Bin Number (FFT Size)', 'FontSize', 32);
    ylabel('Power (dB)', 'FontSize', 32);
    
    %     N = 20*log10(var(abs(x)-1))
    
    disp(sprintf('Symbol Number: %d\n', i))
%     disp(sprintf('\tFreq Error: %f\n', anglesh_pn(1+(i-1)*fft_size)))
    pause

end