Personal tools
  •  

BaseProject.m

Document Actions
  • Bookmarks
  • CourseFeed

Click here to get the file

Size 2.2 kB - File type text/plain

File contents

             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  TITLE: FINAL PROJECT FOR ECE 5660, SPRING 2006
%
%  NAME: <put your name here>
%  DATE: <put the date you turn this in here>
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Constants
rt2 = sqrt(2);

% Simulation parameters
Ts = 1;    % Symbol period (seconds)
N = 4;     % Samples per symbol period
T = Ts/N;  % Sample period (seconds)
Fc = 0.2; % Discrete-time carrier frequency (cycles/sample)
fc = Fc/T; % Continuous-time carrier frequency (Hertz)
NumSymbols = 1000;
duration = NumSymbols*Ts; % Length of simulation (seconds)
A = 1;     % Signal amplitude

a = 0.35; % Excess bandwidth
Lp = 6;   % RTRC trucation (symbol periods)
n = [-Lp*N:Lp*N]+1e-7;
rtrcpulse = sqrt(N)*(sin(pi*(1-a)*n/N) + (4*a*n/N).*cos(pi*(1+a)*n/N))./(pi*n.*(1-(4*a*n/N).^2));
pulse = rtrcpulse;
Lpulse = length(pulse);

nvar = 0.0; % Noise variance
nstd = sqrt(nvar); % Noise standard deviation

% Look up table properties
M = 16;
LUTin  = [0:M-1];
LUT0 = [1;1;1;1]*[-3,-1,1,3]*A; LUT0 = reshape(LUT0,1,M);
LUT1 = [-3;-1;1;3]*[1,1,1,1]*A; LUT1 = reshape(LUT1,1,M);
LUTdecision = [LUT0; LUT1];

% Design PLL parameters
BnTs = 0.0005;
zeta = 1/sqrt(2);

% Buffers
p0buff = zeros(Lpulse,1);
p1buff = zeros(Lpulse,1);

% Start simulation loop
Ncnt = 0;
for t=1:T:duration
  if(Ncnt==0)
    Ncnt = N-1;
    % Generate new bits and symbols
    bits = randn(log2(M),1);
    bits = 0*(bits>0)+(bits<=0);
    i = 2.^[0:log2(M)-1]*bits + 1;
    a0 = LUT0(i);
    a1 = LUT1(i);
  else
    a0 = 0; % This is for upsampling
    a1 = 0; % This is for upsampling
    % Modify counter
    Ncnt = Ncnt - 1;
  end
  
  % Fill up transmitter pulse buffer
  p0buff = [a0;p0buff(1:Lpulse-1)];
  p1buff = [a1;p1buff(1:Lpulse-1)];
  
  % Compute transmitter pulse output
  s0 = pulse*p0buff;
  s1 = pulse*p1buff;
  
  % Compute modulated signal
  s = rt2*(s0*cos(2*pi*fc*t) - s1*sin(2*pi*fc*t));
  
  % Compute received signal
  r = s + nstd*randn(1,1); % Additive white Gaussian noise

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Put your code here
  % 
  % Your code should synchronize with the data in the signal r
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
end
            
Copyright 2008, by the Contributing Authors. Cite/attribute Resource . admin. (2006, June 29). BaseProject.m. Retrieved January 07, 2011, from Free Online Course Materials — USU OpenCourseWare Web site: http://ocw.usu.edu/Electrical_and_Computer_Engineering/Communication_Systems_I/baseproject.m-view.html. This work is licensed under a Creative Commons License Creative Commons License