1% hackrf_dc.m 2% 3% David Rowe Nov 2015 4% 5% Downconverts a HackRF IQ sample file to a lower sample rate 6% 7% To sample a -60dB signal: 8% $ hackrf_transfer -r df1.iq -f 439200000 -n 10000000 -l 20 -g 40play file at 10.7MHz used: 9% octave:25> d = hackrf_dc("df1.iq") 10 11function d = hackrf_dc(infilename) 12 Fs1 = 10E6; % input sample rate to HackRF 13 Fs2 = 96E3; % output sample rate 14 fc = 700E3; % offset to shift input by, HackRF doesn't like signals in the centre 15 16 s1 = load_hackrf(infilename); 17 ls1 = length(s1); 18 ls1 = 20*Fs1; 19 t = 0:ls1-1; 20 21 % shift down to baseband from Fc, not sure of rot90 rather than trasnpose operator ' 22 % to avoid unwanted complex conj 23 24 s2 = rot90(s1(1:ls1)) .* exp(-j*2*pi*t*fc/Fs1); 25 d = resample(s2, Fs2, Fs1); 26end 27