% plot_PhaseTree - plot phase tree for CPFSK

%% Initialization
NumInt = 4;  % number of intervals to construct
InitPhase = [ 0 ];
Symbols = [ 1 -1 ];
FinalPhase= [];

%% initialize graphics
figure(1)
clf reset
hold on

for kk = 1:NumInt
    for nn = 1:length(InitPhase)
        for mm = 1:length(Symbols)
            FinalPhase((nn-1)*length(Symbols)+mm) = InitPhase(nn) + Symbols(mm);
            plot( [kk-1 kk], [InitPhase(nn) (InitPhase(nn) + Symbols(mm))],'-o');
        end
    end
    InitPhase = FinalPhase;
end

hold off
xlabel('Time/T')
ylabel('Excess Phase/\pi')
set(gca,'YTick',-4:1:4);
set(gca,'YTickLabel',...
    {'-4h','-3h','-2h','-h','0','h','2h','3h','4h'});
 grid
 
%% Store name of script for automated figure generation
ScriptName = mfilename;