% plot_SpecCPMPartialResponse - Spectrum partial response CPM signals

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

%% Parameters:
fsT      = 20;
Alphabet = [1, -1];                         % BPPSK
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'];

Ls = 1:4;

for mm=1:length(Ls)
    L = Ls(mm);

    Ps = zeros( 1, (Ns+L-1)*fsT );
    for kk = 1:M
        %% symbols and Signal using our functions
        Pulse    = RectPulse( L*fsT);    % rectangular 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 -60 20] );
legend('L=1','L=2','L=3','L=4');
hold off

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