Merging OFDM features branch r5661:5759 into trunk. OFDM works over the air with...
[debian/gnuradio] / gnuradio-examples / python / ofdm / plot_ofdm.m
1 function plot_ofdm(fft_size, occ_tones)
2
3 ofdm = read_complex_binary('ofdm_corr_out_c.dat');
4 ofdm_split = split_vect(ofdm, occ_tones);
5
6 fftc = read_complex_binary('fft_out_c.dat');
7 fftc_split = split_vect(fftc, fft_size);
8
9 figure(1)
10 set(gcf, 'Position', [50 50 1000 600]);
11
12 a = size(ofdm_split);
13 if nargin == 3
14     maxcount = count;
15     if maxcount > a(1)
16         error('plot_ofdm:tolong', 'Requested count size exceeds size of vectors');
17     end
18 else
19     maxcount = a(1);
20 end
21
22 for i = 1:20000
23     x = ofdm_split(i,:);
24     y = fftc_split(i+1,:);
25     
26     subplot(2,2,1)
27     plot(real(x), imag(x), 'bo')
28     set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
29     axis([-1.5, 1.5, -1.5, 1.5])
30     title('I&Q Constellation', 'FontSize', 36);
31     xlabel('Inphase', 'FontSize', 32);
32     ylabel('Quadrature', 'FontSize', 32);
33     
34     subplot(2,2,3)
35     plot(angle(x*j), 'bo')
36     set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
37     axis([0, occ_tones, -3.5, 3.5])
38     title('Equalized Symbol Angle', 'FontSize', 36);
39     xlabel('Bin Number (Occ. Tones)', 'FontSize', 32);
40     ylabel('Symbol Angle', 'FontSize', 32);
41     
42     subplot(2,2,2)
43     plot(angle(y*j), 'bo')
44     set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
45     axis([0, fft_size, -3.5, 3.5]) 
46     title('Unequalized Symbol Angle', 'FontSize', 36);
47     xlabel('Bin Number (FFT Size)', 'FontSize', 32);
48     ylabel('Symbol Angle', 'FontSize', 32);
49     
50     Y = 20*log10(abs(y) ./ max(abs(y)));
51     subplot(2,2,4)
52     plot(Y, 'b-')
53     set(gca, 'FontSize', 30, 'FontWeight', 'Bold');
54     axis([0, fft_size, -50, 1]);
55     title('Frequency Domain of Unequalized Rx', 'FontSize', 36);
56     xlabel('Bin Number (FFT Size)', 'FontSize', 32);
57     ylabel('Power (dB)', 'FontSize', 32);
58     
59     %     N = 20*log10(var(abs(x)-1))
60     
61     disp(sprintf('Symbol Number: %d\n', i))
62 %     disp(sprintf('\tFreq Error: %f\n', anglesh_pn(1+(i-1)*fft_size)))
63     pause
64
65 end