% The University of Queensland % School of Information Technology & Electrical Engineering % COMS3100/7100 Introduction to Communications % Plot a waveform similar to the in CCR Fig. 11.4-2 % Set up a bit stream, of which we will only plot a few bits = [0 0 1 0 1 0 1 1 0 1 0 0 1 0 1]; % Set up a time axis (t starts at -3) tstart = -3; tend = length(bits) + tstart - 1; n = tstart:tend; t = tstart:0.1:tend; tmat = ones(length(n), 1) * t - n' * ones(1, length(t)); % Generate the low-passed received waveform (sum of raised cosine pulse % shapes, not covered in COMS3100/7100) a = ((2 * bits)-1); y = zeros(1, length(t)); for i = 1:length(bits), tshift = t - n(i); y = y + a(i) * sinc(tshift) .* cos(0.99 * pi * tshift) ... ./ (1 - 4 * 0.99^2 * tshift.^2); end; subplot(3, 1, 1); plot(t, y); xlim([0.4, 8.1]); xlabel('t'); ylabel('y(t)'); % Generate the squared version yy = y.^2; subplot(3, 1, 2); plot(t, yy); xlim([0.4, 8.1]); xlabel('t'); ylabel('y^2(t)'); % Generate a bandpass filtered version (by applying a low-pass then a % high-pass filter) [b, a] = butter(5, 0.22); lp = filtfilt(b, a, yy); [b, a] = butter(5, 0.18, 'high'); bp = filtfilt(b, a, lp); subplot(3, 1, 3); plot(t, bp); xlim([0.4, 8.1]); xlabel('t'); ylabel('cos 2 \pi r_b t');