t = (0 : 1 / fs : numSymbs / Rsym + (1.5 * span * sps - 1) / fs)';
-
-
EbN0_db = 0:0.2:10;
EbN0 = 10 .^ (EbN0_db ./ 10);
xBaseband = txFilter([modData; zeros(span, 1)]);
+
%fc = 2.5e6; % Carrier freq (Hz)
%carrier = sqrt(2) * exp(j * 2 * pi * fc * t);
%xPassbandIdeal = normalizeEnergy...
% (real(xBaseband .* carrier(1:length(xBaseband))), numSymbs, 1);
- txLOFreq = [2.49e6, 2.5e6, 2.51e6];
+ %txLOFreq = [2.49e6, 2.5e6, 2.51e6];
%%txLOEnergy = [0.05, 0.9, 0.05];
- txLOEnergy = [0 1 0];
+ %txLOEnergy = [0 1 0];
+ txLOFreq = [1e8];
+ txLOEnergy = [1];
carrier = zeros(length(t), 1);
for i = 1 : length(txLOFreq)
end
xPassband = normalizeEnergy...
- (real(xBaseband .* carrier(1:length(xBaseband))), numSymbs, 1);
-
- sum(abs(xPassband) .^ 2) / numSymbs
- input('pause')
-
+ (xBaseband .* carrier(1:length(xBaseband)), numSymbs, 1);
for i = 1:plotlen
snr = EbN0_db(i) + 10 * log10(log2(M)) - 10 * log10(sps); % why sps?
noiseEnergy = 10 ^ (-snr / 10);
-
yPassband = awgn(xPassband, snr, 'measured');
-
- rBaseband = rxFilter([yPassband .* carrier(1:length(yPassband)); zeros(span * sps, 1)]);
+ rBaseband = rxFilter([yPassband .* conj(carrier(1:length(yPassband))); zeros(span * sps, 1)]);
%% truncate filter transients
rBaseband = rBaseband(span * sps / 2 + 1 : end);
%% normalize energy
rBaseband = normalizeEnergy(rBaseband, numSymbs, 1 + noiseEnergy);
-
rSampled = rBaseband(sps*span/2+1:sps:(numSymbs + span/2) * sps);
demodData = pskdemod(rSampled, M, 0, 'gray');