diff options
| author | Author Name <[email protected]> | 2023-07-07 12:20:59 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-07 12:29:06 +0930 |
| commit | ac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch) | |
| tree | a2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /octave/hackrf_dc.m | |
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'octave/hackrf_dc.m')
| -rw-r--r-- | octave/hackrf_dc.m | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/octave/hackrf_dc.m b/octave/hackrf_dc.m new file mode 100644 index 0000000..a204e70 --- /dev/null +++ b/octave/hackrf_dc.m @@ -0,0 +1,26 @@ +% hackrf_dc.m +% +% David Rowe Nov 2015 +% +% Downconverts a HackRF IQ sample file to a lower sample rate +% +% To sample a -60dB signal: +% $ hackrf_transfer -r df1.iq -f 439200000 -n 10000000 -l 20 -g 40play file at 10.7MHz used: +% octave:25> d = hackrf_dc("df1.iq") + +function d = hackrf_dc(infilename) + Fs1 = 10E6; % input sample rate to HackRF + Fs2 = 96E3; % output sample rate + fc = 700E3; % offset to shift input by, HackRF doesn't like signals in the centre + + s1 = load_hackrf(infilename); + ls1 = length(s1); + ls1 = 20*Fs1; + t = 0:ls1-1; + + % shift down to baseband from Fc, not sure of rot90 rather than trasnpose operator ' + % to avoid unwanted complex conj + + s2 = rot90(s1(1:ls1)) .* exp(-j*2*pi*t*fc/Fs1); + d = resample(s2, Fs2, Fs1); +end |
