Split the creation of the ZC sequence out from creating time domain

pull/2/head
David Protzman 2022-04-23 00:47:59 -04:00
rodzic 20b313259c
commit 8b347811bd
2 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -21,9 +21,7 @@ function [samples] = create_zc(fft_size, symbol_index)
root = 147;
end
% Would use MATLAB's zadoffChuSeq function, but Octave doesn't have that
% The logic below was tested against the MATLAB function
zc = reshape(exp(-1j * pi * root * (0:600) .* (1:601) / 601), [], 1);
zc = reshape(create_zc_seq(fft_size, root), [], 1);
% Figure out how many guard carriers there should be (purposely ignoring DC here)
guard_carriers = fft_size - 600;
@ -39,7 +37,9 @@ function [samples] = create_zc(fft_size, symbol_index)
% Null out the DC carrier
samples_freq(fft_size/2) = 0;
samples_freq
% Convert to time domain making sure to flip the spectrum left to right first
samples = ifft(fftshift(samples_freq));
samples = ifft(fftshift(samples_freq)) / fft_size;
end

Wyświetl plik

@ -0,0 +1,8 @@
function [zc_seq] = create_zc_seq(fft_size, root)
assert(log2(fft_size) == round(log2(fft_size)), "Invalid FFT size. Must be power of 2");
% Would use MATLAB's zadoffChuSeq function, but Octave doesn't have that
% The logic below was tested against the MATLAB function
zc_seq = exp(-1j * pi * root * (0:600) .* (1:601) / 601);
end