% plot_LinearModQPSK - QPSK modulation baseband and passband

%% Parameters:
fsT      = 20;
L        = 10;
fc       =  2;            % carrier frequency
Alphabet = [1, j, -j, -1];% QPSK
Priors   = 0.25*[1 1 1 1];
Pulse    = ones(1,fsT);   % rectangular pulse

%% symbols and Signal using our functions
Symbols   = RandomSymbols(10, Alphabet, Priors);
Signal    = LinearModulation(Symbols,Pulse,fsT);
%% passband signal
tt = (0 : length(Signal)-1 )/fsT;
Signal_PB = sqrt(2)*real( Signal .* exp(-j*2*pi*fc*tt) );

%% plot
subplot(2,1,1)
plot( tt, Signal_PB )
grid
xlabel('Time/T')
ylabel('Amplitude')

subplot(2,2,3)
plot( tt, abs( Signal ) )
grid
xlabel('Time/T')
ylabel('Magnitude')

subplot(2,2,4)
plot( tt, angle( Signal )/pi )
grid
xlabel('Time/T')
ylabel('Phase/\pi')

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