% plot_SpecGMSKBT - Spectrum of GMSK signals 

%% clear graphics and hold on
figure(1)
clf reset
hold on

%% Parameters:
fsT      = 20;
L        = 10;
Alphabet = [1, -1];                         % BPSK
Priors   = ones( size( Alphabet) ) / length(Alphabet);
Ns       = 100;                             % number of symbols
M        = 500;                             % number of trials
A        = 1;
h        = 1/2;

colors = ['b','r','g','k'];

BTs = [0.2 0.3 0.5 1.0];

for mm=1:length(BTs)
    BT = BTs(mm);

    Ps = zeros( 1, (Ns+L-1)*fsT );
    for kk = 1:M
        %% symbols and Signal using our functions
        Pulse    = GaussPulse( L, BT, fsT );    % Gaussian pulse
 
        Symbols  = RandomSymbols(Ns, Alphabet, Priors);
        Signal   = CPM(Symbols,A, h, Pulse,fsT);

        %% periodogram
        Ps  = Ps  + Periodogram( Signal );
    end

    Ps = Ps/M;

    %% plot
    ffT = (-length(Ps)/2 : length(Ps)/2-1)/length(Ps)*fsT;
    plot(ffT, 10*log10( Ps ),colors(mm) )
end

grid
xlabel('Normalized Frequency (fT)')
ylabel('PSD (dB)')
axis([-5 5 -120 20] );
legend('BT=0.2','BT=0.3','BT=0.5','BT=1');
hold off

%% Store name of script for automated figure generation
ScriptName = mfilename;