global Rs;
Rs = 50; % symbol rate in Hz
global Nc; % number of carriers
+if isempty(NumCarriers)
Nc = 14;
+else
+ Nc = NumCarriers;
+end
global Nb;
Nb = 2; % Bits/symbol for PSK modulation
global Rb;
if sync_bit == 0
bad_sync = 0;
else
- printf("inc ");
bad_sync++;
if bad_sync > 2
next_state = 0;
if sync_bit == 1
bad_sync = 0;
else
- printf("inc ");
bad_sync++;
if bad_sync > 2
next_state = 0;
% Version 2
%
-function fdmdv_demod(rawfilename, nbits, errorpatternfilename)
+function fdmdv_demod(rawfilename, nbits, NumCarriers, errorpatternfilename)
fdmdv; % include modem code
-
+
modulation = 'dqpsk';
fin = fopen(rawfilename, "rb");
plot(0.30 + p + 0.25*error_pattern_log(p*2:Nc*Nb:lep),'r')
end
hold off;
- axis([1 lep/(Nc*Nb) 0 15])
+ axis([1 lep/(Nc*Nb) 0 Nc])
end
figure(7)
plot(0.30 + p + 0.25*error_pattern_log_inter(p*2:Nc*Nb:lep),'r')
end
hold off;
- axis([1 lep/(Nc*Nb) 0 15])
+ axis([1 lep/(Nc*Nb) 0 Nc])
end
% save error pattern file
- if nargin == 3
+ if nargin == 4
fout = fopen(errorpatternfilename, "wb");
fwrite(fout, error_pattern_log, "short");
fclose(fout);