No BSD License  

Highlights from
BPSK Simulator for Low Rate Transmisions

image thumbnail

BPSK Simulator for Low Rate Transmisions

by

 

01 Jun 2004 (Updated )

BPSK Simulator for didactical purposes. Systemic coding style.

PAMgen.m
function PAM = PAMgen(bitSeq, bitsWord, samplesBit)
%------------------------------------------------------------------------
%|  function out = PAMgen(bitSeq, bitsWord, samplesSymbol)
%------------------------------------------------------------------------
%|
%|    Function that implements a PAM generator. Do not implements 
%|  raise cosine filtering, just the PAM generation.
%|
%|    DO NOT VALIDATE INPUT PARAMETERS !!!!!!!!!
%| 
%|    Inputs:
%|       1.- BIT_SEQ     = input bits secuence.
%|              Restrictions: must contain N words
%|                    (ie.:  N + 1/2 words not allowed)
%|       2.- BITS_WORD   = bits per Word
%|       3.- SAMPLES_BIT = OverSamping coeficient
%|
%|   Outputs:
%|       1.- PAM = Pulse Ampitude Modulated signal.
%|
%|     NOTA: Signal Toolbox required
%|
%-------------------------------------------------------------------------
%|   Autor: Cesar Delgado
%|   Fecha: 19-Abril-2.004
%-------------------------------------------------------------------------

% 1.- Local Variables Required
%-----------------------------
lonSeq  = length(bitSeq);      % Input secuence length
samSymb = samplesBit*bitsWord; % Samples / symbol
nWords  = lonSeq/bitsWord;     % N words on input secuence

% 2.- Reshaping input secuence on a set of words
%------------------------------------------------
bitSeq= reshape(bitSeq, bitsWord, nWords)';

% 3.- Generating PAM
%-------------------
% >>>> 3.1.- Levels calculation
amplitudes = bi2de(double(bitSeq))'; % PAM levels
 
% >>>> 3.2.- Interpolating values
h   = ones(1,samSymb);  % Interpolation filter time response
inter(1:samSymb:samSymb*nWords) = amplitudes;   
out = conv(inter,h);    
 
% >>>> 3.3.- Removing mean value
media = (2^bitsWord-1)./2;
PAM = out-media.*ones(1,length(out));

 

Contact us