Hi Kire,
i just discovered your post on reddit
http://www.reddit.com/r/RTLSDR/comments/u4pjc/measurements_of_e4000_filter_…
Thanks a lot for sharing your findings with the community. I'm looking
forward to see the NF and IMD measurements :).
Also i think the octave code has definitely educational value for me
personally and likely for everyone else as well.
Dimitri
On Mon, 21 May 2012 23:24:10 +0200, Kire Pudsje <kirepudsje(a)gmail.com>
wrote:
I wrote for myself an octave wrapper for all functions
in the header
file of the rtl-sdr library. Even the async routine generates a
callback to octave functions. The whole is a 1-to-1 mapping of the
functions, I tried to stay as close as possible to the C-library.
I do not know if it just me using octave, but if there is any interest
in this code, I could place it somewhere.
sample code:
pkg load rtlsdr
if rtlsdr_get_device_count()>0
dev = rtlsdr_open(0);
samprate=2048e3;
nsamples=2048;
rtlsdr_set_sample_rate(dev, samprate);
rtlsdr_set_center_freq(dev, 100e6);
rtlsdr_set_tuner_gain_mode(dev, 0);
rtlsdr_reset_buffer(dev);
buf = rtlsdr_read_sync(dev, nsamples * 2);
d = (double(buf) - 128) / 128.0;
d = d(1:2:end) + 1i * d(2:2:end);
f = (-.5:1/nsamples:.5-1/nsamples) * samprate;
plot(f, 20*log10(abs(fftshift(fft(d .* blackman(nsamples)') /
nsamples))));
rtlsdr_close(dev);
end