Skip to content
Snippets Groups Projects
Commit 1d1ac225 authored by Mehdi Khairy's avatar Mehdi Khairy
Browse files

added split offset for simulation

parent a72ffda8
No related branches found
No related tags found
No related merge requests found
......@@ -13,11 +13,24 @@ function sig = modulate(msg, syms)
end
endfunction
% To be included in an other file
% Generate a signal with power 1 by default
function sym_array = gen_sym_array(nb_freq, FS, freq_step, nb_sample, tx_offset)
sym_array = zeros(nb_freq, nb_sample);
t = (1:nb_sample);
for i = 1:nb_freq
fstart = 0 - (nb_freq-1) / 2;
findex = (fstart + i) * freq_step;
sym_freq = exp(j*2*pi*((findex+tx_offset)/FS)*t);
sym_array(i,1:nb_sample) = sym_freq;
end
endfunction
function np = gennoise(power, len)
np = (sqrt(1/2)*randn(1,len)+j*sqrt(1/2)*randn(1,len)) * sqrt(power);
endfunction
function symlist = symgen()
%function symlist = symgen()
freq_step = 6.25; % 50Hz / 8
nb_freq = 8;
......@@ -25,20 +38,11 @@ nb_freq = 8;
FS = 100;
nb_sample = 16; % Some information talk about 160ms symbol duration
% Generating the 8 frequencies
sym_array = zeros(nb_freq, nb_sample);
t = (1:nb_sample);
% TX Offset
tx_offset = 0;
% Generate a signal with power SQRT(2) by default
for i = 1:nb_freq
fstart = 0 - (nb_freq-1) / 2;
findex = (fstart + i) * freq_step;
sym_freq = exp(j*2*pi*((findex+tx_offset)/FS)*t);
sym_array(i,1:nb_sample) = sym_freq;
end
% Generating the 8 frequencies
sym_array = gen_sym_array(nb_freq, FS, freq_step, nb_sample, tx_offset);
% FT8 is 79 symbol: 7 + 29 + 7 + 29 + 7
costas = [2 5 6 0 4 1 3];
......@@ -56,11 +60,14 @@ total_samples = msg_len * nb_sample;
signal = zeros(1,total_samples);
signal = modulate(msg, sym_array);
% Generating the 8 frequencies with 0 offset
sym_array = gen_sym_array(nb_freq, FS, freq_step, nb_sample, 0);
costas_mod = modulate(costas, sym_array);
% signal is now containing a fake frame of FT8
% needs to add noise power calculation
Pn = 10; % Noise power relative to signal power
Pn = 0.1; % Noise power relative to signal power
signoise = signal + gennoise(Pn, length(signal));
corresigcost = xcorr(signoise, costas_mod);
plot(abs(corresigcost));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment