IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

F_EVM_Computation_on_Symbols.m 2.29 KB
Newer Older
Martin Hudlicka's avatar
Martin Hudlicka committed
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
function [G_OPT,EVM] = F_EVM_Computation_on_Symbols(params,Symb,Sideal)

    % This function performs EVM computation on symbols according to Section
    % 5.2.1.5 of the IEEE P1765 Baseline EVM Algorithm for OFDM:
    % Determine the EVM of the User-Lab and Reference-Lab Measured Waveforms
    % 
    % Inputs: 
    %   Symb or r(nT): Recovered OFDM symbols
    %   Sideal: Ideal OFDM symbols from ideal signal
    %   params: structure containing the basic communication paramters
    % 
    % Outputs:
    %   G_OPT: Optimum gain on symbols for EVM computation
    %   EVM or Baseline signal EVM: Baseline rms EVM in percent

    global structGlobal

    %------------------------------------
    % computation of  EVM on all symbols
    %------------------------------------

    % Auto and cross-correlations at time 0 for normalization of symbols
    CC = dot(Symb, Sideal);           %   conjugate of Symb * Sideal';
    ACideal = dot(Sideal, Sideal);    %   Sideal * Sideal';
    AC = dot(Symb, Symb);             %   Symb * Symb';

    % normalization of symbols
    G_OPT = CC / AC ;      %   Gsymb = CC / ACideal;

    fprintf('Optimum gain on symbols for EVM computation\n');
Martin Hudlicka's avatar
Martin Hudlicka committed
31
    fprintf(' amplitude = %8.6f    phase = %8.2f °\n',...
Martin Hudlicka's avatar
Martin Hudlicka committed
32
33
34
35
36
37
38
39
40
41
42
43
44
        abs(G_OPT), angle(G_OPT) * 180 / pi );

    % EVM Calculation same as the single-carrier case Section 5.1.2.5
    EV = G_OPT*Symb - Sideal;
    EVM = sqrt(dot(EV,EV)/dot(Sideal,Sideal));
    
%     % The EVM computation in Lines 42 to 47 follows the same Math as in the
%     % single-carrier case. It computes the same values but with less
%     % computation and errors. Provided here for reference.
%     % Computation of  EVM on symbols
%     cos2 = real(CC*conj(CC) / AC / ACideal);
%     if structGlobal.printdebug
%         fprintf('Angle between measured symbols and reference symbols\n');
Martin Hudlicka's avatar
Martin Hudlicka committed
45
%         fprintf(' cos2 = %8.6f    angle = %10.6f °\n',cos2,acosd(sqrt(cos2)));
Martin Hudlicka's avatar
Martin Hudlicka committed
46
47
48
49
50
51
52
53
54
55
56
%     end
%     EVM = sqrt(1/cos2-1); % = tangent of angle
    
    
    fprintf('EVM measured on all symbols\n');
    fprintf(' EVM = %8.4f %%  or  %6.2f dB\n',EVM * 100, 20*log10(EVM));

    % Plot constellation for all symbols
    Symb = Symb * G_OPT * params.Ac;
    Sideal = Sideal * params.Ac;
    if structGlobal.tracedebug >0
Martin Hudlicka's avatar
Martin Hudlicka committed
57
        F_Plot_Constellation_Diagram_OFDM(Sideal,Symb,params);
Martin Hudlicka's avatar
Martin Hudlicka committed
58
59
    end

Martin Hudlicka's avatar
Martin Hudlicka committed
60
end