% demoLinearMod - simple demos with linearBBMod

%% Configuration
fs = 100;
T = 1;
fsT = fs*T;

fc = 2;

% symbols
symbols = [1, -1, -1, -1, 1, 1]; % BPSK
%symbols = [1, -1, 3];            % 4PAM
%symbols = [1-j, -1-j, 1+j];      % QPSK

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

%% modulate and upconvert
msg = linearBBMod(symbols, pulse, fsT);
sp = upconvert(msg, fc, fs);

%% plot 
% if msg os real-valued, we plot both baseband and passnd signal.
% Otherwise, only the passband signal

tt = (0:length(msg)-1)/fs;
if isreal(msg)
    plot(tt, sp, 'b-', tt, msg, 'r--');
else
    plot(tt, sp, 'b-')
end

grid on
xlabel('Time (symbol periods)');
ylabel('Amplitude')
