\r
sc = 1; hf_n = 1;\r
hf_sim_delay_line = zeros(1,M+Nhfdelay);\r
- freq_sample = Fcentre + ((Fsep*(-Nc/2)):50:(Fsep*(Nc/2)));\r
- freq_sample = (2*pi/Fs)*freq_sample;\r
- hf_model = ones(Ntrials*Nsymb/Nc, length(freq_sample)); % defaults for plotting surface\r
+ freq_sample_hz = Fcentre + ((Fsep*(-Nc/2)):50:(Fsep*(Nc/2)));\r
+ freq_sample_rads = (2*pi/Fs)*freq_sample_hz;\r
+ hf_model = ones(Ntrials*Nsymb/Nc, length(freq_sample_rads)); % defaults for plotting surface\r
\r
% bunch of outputs we log for graphing\r
\r
\r
% Now we start processing frame Nc symbols at a time to model parallel carriers\r
\r
+ tx_fdm_sym_log = [];\r
for i=1:Nc:Nsymb\r
\r
% Delay tx symbols to match delay due to filters. qpsk\r
\r
% sample HF channel spectrum in middle of this symbol for plotting\r
\r
- hf_model(hf_n,:) = hf_gain*(spread(sc+M/2) + exp(-j*freq_sample*Nhfdelay)*spread_2ms(sc+M/2));\r
+ hf_model(hf_n,:) = hf_gain*(spread(sc+M/2) + exp(-j*freq_sample_rads*Nhfdelay)*spread_2ms(sc+M/2));\r
\r
sc += M;\r
hf_n++;\r
end\r
\r
+ tx_fdm_sym_log = [tx_fdm_sym_log tx_fdm ];\r
+\r
% AWGN noise and phase/freq offset channel simulation\r
% 0.5 factor ensures var(noise) == variance , i.e. splits power between Re & Im\r
\r
% est HF model power for entire code frame (which could be several symbols)\r
\r
if hf_sim\r
- frame_hf_model = reshape(hf_model(hf_n-Nsymb/Nc:hf_n-1,:),1,(Nsymb/Nc)*length(freq_sample)); \r
+ frame_hf_model = reshape(hf_model(hf_n-Nsymb/Nc:hf_n-1,:),1,(Nsymb/Nc)*length(freq_sample_hz)); \r
sim_out.hf_model_pwr = [sim_out.hf_model_pwr mean(abs(frame_hf_model).^2)];\r
else \r
sim_out.hf_model_pwr = [sim_out.hf_model_pwr 1];\r
\r
% "genie" SNR estimate \r
\r
- snr = (tx_fdm*tx_fdm')/(M*variance);\r
+ snr = (tx_fdm_sym_log*tx_fdm_sym_log')/(M*variance);\r
sim_out.snr_log = [sim_out.snr_log snr];\r
\r
% de-modulate\r
figure(3);\r
clf; \r
y = 1:Rs*2;\r
- [rr,cc] = size(hf_model);\r
- x = 1:cc;\r
EsNodBSurface = 20*log10(abs(hf_model(y,:))) + EsNodB;\r
- mesh(x,y,EsNodBSurface);\r
+ mesh(1:length(freq_sample_hz),y,EsNodBSurface);\r
grid\r
title('HF Channel Es/No');\r
end\r
sim_in.hf_delay_ms = 2;\r
sim_in.hf_sim = 1;\r
sim_in.Esvec = 10;\r
-sim_in.Ntrials = 100;\r
+sim_in.Ntrials = 400;\r
\r
dqpsk_pwr_hf = ber_test(sim_in);\r
\r