% plot_OQPSKRaisedCosMagPhase - plot magnitude and phase of OQPSK signal

%% Parameters:
fsT      = 20;
L        = 10;
Alphabet = [1,-1];                          % BPSK
Priors   = ones( size( Alphabet) ) / length(Alphabet);
Ns       = 20;                              % number of symbols
Pulse    = RaisedCosPulse( L, fsT, 0.5);    % RC pulse

%% symbols and Signal using our functions
Symbols = RandomSymbols(Ns, Alphabet, Priors);
Symbols = OQPSK(Symbols);
Signal  = LinearModulation(Symbols,Pulse,fsT);
%% plot
tt = (0 : length(Signal)-1 )/fsT;
subplot( 2, 1, 1 )
plot(tt, abs( Signal ), (L/2:L/2+Ns-1) , abs( Symbols ), 'ro')
grid
xlabel('Time/T')
ylabel('Magnitude')
axis([5 15 0 1.5] );

subplot( 2, 1, 2 )
plot(tt, angle( Signal )/pi, ...
    (L/2:L/2+Ns-1) , angle( Symbols )/pi, 'ro')
grid
xlabel('Time/T')
ylabel('Phase/\pi')
axis([5 15 -1.2 1.2] );


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