% plot_PSD - plot the PSD of a linearly modulated signal

T = 1;
fs = 16;
fsT = fs*T;

Nsymbols = 8196;
win = hamming(1024).';

% pulse shape
pulse = ones(1,fsT);             % rectangular
pulse = sin(pi*(0:fsT-1)/fsT);  % half sine
%pulse = sin(pi*(0:fsT-1)/fsT).^2;

% random symbols
symbols = 2*(rand(1,Nsymbols)>0.5) - 1;  % BPSK
symbols = sqrt(0.5)*(1j*(2*(rand(1,Nsymbols)>0.5) - 1) + ...
    1j*(2*(rand(1,Nsymbols)>0.5) - 1)); %QPSK

% digital modulation
sig = linearBBMod(symbols, pulse, fsT);

[Sx, ff] = estimatePSD(sig, win, fs);

plot(ff, 10*log10(Sx));
grid on
xlabel('Frequency (Hz)')
ylabel('PSD (dB/Hz)')
