clear all, clc, close hidden all
% 1.- ENVIROMENTAL VARIABLES
%----------------------------
fs = 2^15; % Sample Frecuency
Rb = 2^9; % Binary speed
fi = 2^12; % Carrier frecuency
phase = 0; % Origin of Phase
L = fs/Rb; % Oversampling relation
% 2.- INPUT SECUENCE
%-------------------
In = randn(1,20)>0; % 20 bits
% 3.- QPSK MODULATION
%----------------
%>>> 3.1.- Generating IQ signals
[I,Q] = IQsignals(In,L, 1);
%>>> 3.2.- Modulating those signals
nSamples = length(I);
t = (0:nSamples-1)./fs;
Is = I.*cos(2*pi*fi*t+phase.*ones(1,nSamples));
Qs = Q.*sin(2*pi*fi*t+phase.*ones(1,nSamples));
%>>> 3.3.- Output Signal
Out = Is+Qs;
% 4.- REPRESENTING RESULTS
%--------------------------
title('Results of QPSK modulation');
subplot(3,1,1)
plot(t,Is,t,I,'r')
ylabel ('I signal');
subplot(3,1,2)
plot(t,Qs,t,Q,'r')
ylabel ('Q signal');
subplot(3,1,3)
plot(t,Out,'r');
ylabel ('I+Q signal');
zoom on