Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Firas abbas
Dear Aadil,

1) First upgrade to latest gnuradio release.
2) Put the USRP behind. 
3) Start generating the sinewave by software using gr.sig_source
4) Do the mathematics or FFT or whatever you want on this simulated signal.
5) If everything is ok, switch back to USRP, if not, then you have a problem in 
using the gnuradio, and you should learn more.

Regards,

Firas

- Original Message 
From: Aadil Volkwin <[EMAIL PROTECTED]>
To: Eric Blossom <[EMAIL PROTECTED]>
Cc: Firas abbas <[EMAIL PROTECTED]>; discuss-gnuradio@gnu.org
Sent: Saturday, November 10, 2007 6:27:40 PM
Subject: Re: [Discuss-gnuradio] Signal reconstruction





Also, it's not clear to me what you're actually trying to do.

I'd like to capture FM signals and perform ambiguity measurements on them.

at the moment, i am failing to capture data correctly.
 


If you want to plot data in real time, please use either the
usrp_fft.py or usrp_oscope.py applications.  You can capture data
to disk using the usrp_rx_cfile.py example.

I suggest you start with these, then do your own experiments.

These are the files that I have been using. 
usrp_rx_cfile.py to write to file and usrp_fft.py and usrp_oscope.py for 
realtime examination of the data and Matlab for post processing, based on the 
utils in gnuradio-core.


 

Eric






___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Aadil Volkwin
> Also, it's not clear to me what you're actually trying to do.


I'd like to capture FM signals and perform ambiguity measurements on them.

at the moment, i am failing to capture data correctly.


If you want to plot data in real time, please use either the
> usrp_fft.py or usrp_oscope.py applications.  You can capture data
> to disk using the usrp_rx_cfile.py example.
>
> I suggest you start with these, then do your own experiments.


These are the files that I have been using.
usrp_rx_cfile.py to write to file and usrp_fft.py and usrp_oscope.py for
realtime examination of the data and Matlab for post processing, based on
the utils in gnuradio-core.



Eric
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Eric Blossom
On Sat, Nov 10, 2007 at 02:34:11PM +0200, Aadil Volkwin wrote:
> The Scope was definitely usrp_oscope.py Used Directly from the from the
> examples folder:
> 
> [EMAIL 
> PROTECTED]:~/Desktop/GnuRadioResources/gnuradio-3.0.2/gnuradio-examples/python/usrp$
> ./usrp_oscope.py
> 

I note that you are using gnuradio-3.0.2.  That's almost a year old.

I suggest that you consider using the latest stable code, the 3.1.1
release, available at ftp://ftp.gnu.org/gnu/gnuradio/gnuradio-3.1.1.tar.gz

Also, it's not clear to me what you're actually trying to do.
If you want to plot data in real time, please use either the
usrp_fft.py or usrp_oscope.py applications.  You can capture data
to disk using the usrp_rx_cfile.py example.

I suggest you start with these, then do your own experiments.

Eric


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Aadil Volkwin
Thanks for responding and for your input, I answer your questions below,

>You're transmitting a 250kHz square source which is the summation of all
odd harmonics of >250kHz.  I believe that is why you were told to switch
over to a sine wave which you would >probably just see a single tone.

I have switched over to a sine wave, but I still don't get the single peak
on the FFT as one would expect, that's the source of this conversation.

>I am sorry if I am unfamiliar, but what exactly are you trying to
>accomplish, and how do you expect to do it with a square wave?

What I want to do (for now) is be able to correctly digitise a signal and
write it to file (thereafter I will do various signal processing). My short
term objective is to digitise "off air FM signals" and perform ambiguity
measurements.

I'm using the sine wave as input and plotting it's FFT to see if I was able
to correctly digitise it.
This should be a fairly trivial 5min process but I've been at it for a
week!!

Thus far non of the suggestions have helped cure my problem.

Images of my matlab plots are available here:
https://rrsg.ee.uct.ac.za/members/aadil/

I hope you can help, I feel hopeless right now.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Brian Padalino
On Nov 10, 2007 9:39 AM, Aadil Volkwin <[EMAIL PROTECTED]> wrote:
> Ok,
>
> I still have the problem with the reconstruction though.
>
> When I perform the FFT on the sample set, the plots are not as you would
> expect for a pure 250KHz signal?

You're transmitting a 250kHz square source which is the summation of
all odd harmonics of 250kHz.  I believe that is why you were told to
switch over to a sine wave which you would probably just see a single
tone.

Due to bandwidth limitations, transmitting square waves over the air
doesn't work quite as one may expect.

> This is the major concern for me and the crux of my problem.

I am sorry if I am unfamiliar, but what exactly are you trying to
accomplish, and how do you expect to do it with a square wave?

Brian


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Aadil Volkwin
Ok,

I still have the problem with the reconstruction though.

When I perform the FFT on the sample set, the plots are not as you would
expect for a pure 250KHz signal?

This is the major concern for me and the crux of my problem.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Firas abbas
It seems that the signal is ok. If you use a pure sinusoidal signal you will 
see a much clearer picture.

Firas


Aadil Volkwin <[EMAIL PROTECTED]> wrote: It seems I need to hit return after 
i've entered the values, my error.

the new plot is on the website:

https://rrsg.ee.uct.ac.za/members/aadil/

 
 


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Aadil Volkwin
It seems I need to hit return after i've entered the values, my error.

the new plot is on the website:

https://rrsg.ee.uct.ac.za/members/aadil/
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Firas abbas
Hi,

Sorry about the scope file, I using a modified version and it seems that I 
being confused with the standrad one. However, there is something strange in 
the data shown in your picture. Since you are using decimation =8, the data 
coming across the USB should be complex 8 Msps. But your scope is showing 
([EMAIL PROTECTED]: 4M) which is wrong. another thing, the DDC  be should equal 
0 , while in your picture it is being (DDC : -8M) . 

Firas





Aadil Volkwin <[EMAIL PROTECTED]> wrote: The Scope was definitely 
usrp_oscope.py Used Directly from the from the examples folder:

[EMAIL 
PROTECTED]:~/Desktop/GnuRadioResources/gnuradio-3.0.2/gnuradio-examples/python/usrp$
 ./usrp_oscope.py

Aadil

 On 10/11/2007, Firas abbas <[EMAIL PROTECTED]> wrote: Hi,

Input signal level is ok.The scope pictures was not generated by  
usrp_oscope.py. What is the program used to generate it ? Test The signal with 
usrp_oscope.py
 
Firas

Aadil Volkwin <[EMAIL PROTECTED]> wrote:  Hi, 

I've updated the scope screenshot on the website. Two shots are available, 
notice there seems to be some kind of modulation??? I've tested the input 
signal with an external scope and the input signal is fine. I don't know why 
the usrp scope is "misbehaving"  

The input signal level is set at -16.02dBm

Aadil

On 10/11/2007, Firas abbas < [EMAIL PROTECTED] > wrote:Hi,

Use center frequency =0 in the usrp scope. If you use center frequency = 250K, 
you will shift the signal to 0 Hz.  

What is your signal input level in dBm ?

Firas

Aadil Volkwin <  [EMAIL PROTECTED]> wrote: Hi, 

Firstly my apologies for posting known quantities, I guessed that members would 
like to see in what way I tinkered with usrp_rx_cfile.py. point taken though.  

Screen shots of the MATLAB plots as well as the usrp_oscop.py output can be 
found at: 

   https://rrsg.ee.uct.ac.za/members/aadil/

I'm pretty sure the MATLAB is correct.

I have upped the input freq to 250KHz, now attempting a square wave (in 
desperation) and  
set the options.freq to 0 in --->  self.u.tune(0, self.subdev, options.freq)

I'm Still not getting  sensible plots.

Thanks again, 

Aadil
 





 


 


 


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Aadil Volkwin
The Scope was definitely usrp_oscope.py Used Directly from the from the
examples folder:

[EMAIL 
PROTECTED]:~/Desktop/GnuRadioResources/gnuradio-3.0.2/gnuradio-examples/python/usrp$
./usrp_oscope.py

Aadil

On 10/11/2007, Firas abbas <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Input signal level is ok.The scope pictures was not generated by
> usrp_oscope.py. What is the program used to generate it ? Test The signal
> with usrp_oscope.py
>
> Firas
>
> *Aadil Volkwin <[EMAIL PROTECTED]>* wrote:
>
> Hi,
>
> I've updated the scope screenshot on the website. Two shots are available,
> notice there seems to be some kind of modulation??? I've tested the input
> signal with an external scope and the input signal is fine. I don't know why
> the usrp scope is "misbehaving"
>
> The input signal level is set at -16.02dBm
>
> Aadil
>
> On 10/11/2007, Firas abbas <[EMAIL PROTECTED] > wrote:
> >
> > Hi,
> >
> > Use center frequency =0 in the usrp scope. If you use center frequency =
> > 250K, you will shift the signal to 0 Hz.
> >
> > What is your signal input level in dBm ?
> >
> > Firas
> >
> > *Aadil Volkwin < [EMAIL PROTECTED]>* wrote:
> >
> > Hi,
> >
> > Firstly my apologies for posting known quantities, I guessed that
> > members would like to see in what way I tinkered with usrp_rx_cfile.py.
> > point taken though.
> >
> > Screen shots of the MATLAB plots as well as the usrp_oscop.py output can
> > be found at:
> >
> > https://rrsg.ee.uct.ac.za/members/aadil/
> >
> > I'm pretty sure the MATLAB is correct.
> >
> > I have upped the input freq to 250KHz, now attempting a square wave (in
> > desperation) and
> > set the options.freq to 0 in ---> self.u.tune(0, self.subdev,
> > options.freq)
> >
> > I'm Still not getting sensible plots.
> >
> > Thanks again,
> >
> > Aadil
> >
> >
> >
> >
> >
>
>
>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Firas abbas
Hi,

Input signal level is ok.The scope pictures was not generated by  
usrp_oscope.py. What is the program used to generate it ? Test The signal with 
usrp_oscope.py

Firas

Aadil Volkwin <[EMAIL PROTECTED]> wrote: Hi, 

I've updated the scope screenshot on the website. Two shots are available, 
notice there seems to be some kind of modulation??? I've tested the input 
signal with an external scope and the input signal is fine. I don't know why 
the usrp scope is "misbehaving" 

The input signal level is set at -16.02dBm

Aadil

On 10/11/2007, Firas abbas <[EMAIL PROTECTED] > wrote:Hi,

Use center frequency =0 in the usrp scope. If you use center frequency = 250K, 
you will shift the signal to 0 Hz. 

What is your signal input level in dBm ?

Firas

Aadil Volkwin < [EMAIL PROTECTED]> wrote: Hi, 

Firstly my apologies for posting known quantities, I guessed that members would 
like to see in what way I tinkered with usrp_rx_cfile.py. point taken though. 

Screen shots of the MATLAB plots as well as the usrp_oscop.py output can be 
found at: 

 https://rrsg.ee.uct.ac.za/members/aadil/

I'm pretty sure the MATLAB is correct.

I have upped the input freq to 250KHz, now attempting a square wave (in 
desperation) and  
set the options.freq to 0 in ---> self.u.tune(0, self.subdev, options.freq)

I'm Still not getting  sensible plots.

Thanks again, 

Aadil
 





 


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Aadil Volkwin
Hi,

I've updated the scope screenshot on the website. Two shots are available,
notice there seems to be some kind of modulation??? I've tested the input
signal with an external scope and the input signal is fine. I don't know why
the usrp scope is "misbehaving"

The input signal level is set at -16.02dBm

Aadil

On 10/11/2007, Firas abbas <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Use center frequency =0 in the usrp scope. If you use center frequency =
> 250K, you will shift the signal to 0 Hz.
>
> What is your signal input level in dBm ?
>
> Firas
>
> *Aadil Volkwin <[EMAIL PROTECTED]>* wrote:
>
> Hi,
>
> Firstly my apologies for posting known quantities, I guessed that members
> would like to see in what way I tinkered with usrp_rx_cfile.py. point taken
> though.
>
> Screen shots of the MATLAB plots as well as the usrp_oscop.py output can
> be found at:
>
> https://rrsg.ee.uct.ac.za/members/aadil/
>
> I'm pretty sure the MATLAB is correct.
>
> I have upped the input freq to 250KHz, now attempting a square wave (in
> desperation) and
> set the options.freq to 0 in --->self.u.tune(0, self.subdev, options.freq)
>
> I'm Still not getting sensible plots.
>
> Thanks again,
>
> Aadil
>
>
>
>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Firas abbas
Hi,

Use center frequency =0 in the usrp scope. If you use center frequency = 250K, 
you will shift the signal to 0 Hz.

What is your signal input level in dBm ?

Firas

Aadil Volkwin <[EMAIL PROTECTED]> wrote: Hi, 

Firstly my apologies for posting known quantities, I guessed that members would 
like to see in what way I tinkered with usrp_rx_cfile.py. point taken though.

Screen shots of the MATLAB plots as well as the usrp_oscop.py output can be 
found at: 

https://rrsg.ee.uct.ac.za/members/aadil/

I'm pretty sure the MATLAB is correct.

I have upped the input freq to 250KHz, now attempting a square wave (in 
desperation) and  
set the options.freq to 0 in --->self.u.tune(0, self.subdev, options.freq)

I'm Still not getting sensible plots.

Thanks again, 

Aadil
 


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-10 Thread Aadil Volkwin
Hi,

Firstly my apologies for posting known quantities, I guessed that members
would like to see in what way I tinkered with usrp_rx_cfile.py. point taken
though.

Screen shots of the MATLAB plots as well as the usrp_oscop.py output can be
found at:

https://rrsg.ee.uct.ac.za/members/aadil/

I'm pretty sure the MATLAB is correct.

I have upped the input freq to 250KHz, now attempting a square wave (in
desperation) and
set the options.freq to 0 in --->self.u.tune(0, self.subdev, options.freq)

I'm Still not getting sensible plots.

Thanks again,

Aadil
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Signal reconstruction

2007-11-08 Thread Firas abbas
Hi,

I think your problem is simple, you are wrong in two thinks,

1) You chooses to input 50 KHz signal to your USRP, and I think you are using 
the Basic RX daughter board, which have an RF transformer that needs at least 
200KHz input signal to pass it without distortion.

2) You used a DDC default center frequency of 50KHz, which means that your 
input 50 KHz signal will be centered around the 0 Hz!.how you will plot it ?

To have thinks work, input 200 KHz signal, and use 0 Hz as the default frequency
[ parser.add_option("-f", "--freq", type="eng_float", default=0, help="set 
frequency to FREQ", metavar="FREQ")]

Firas,

Aadil Volkwin <[EMAIL PROTECTED]> wrote: Hi, 

I've been bashing my head for a couple of days on what should be a trivial 
process. 
I would really appreciate it if somebody could please come to my rescue.

I'd like to digitise a signal, intented to be off air FM signal, but for the 
moment, i'm capturing a 50KHz sinusiod and doing the reconstruction in 
MATLAB to test that im capturing the samples correctly.  

on plotting the FFT in MATLAB, it's clear that something's a miss...I don't 
know where :/ i've been at this for ages!!!

here's my code: I really hope somebody can help, I know this should be a simple 
matter. The Matlab code follows below the Python stuff. 

=

#!/usr/bin/env python

"""
Read samples from the USRP and write to file formatted as binary
outputs single precision complex float values or complex short values 
(interleaved 16 bit signed short integers). 

"""

from gnuradio import gr, eng_notation
from gnuradio import audio
from gnuradio import usrp
from gnuradio.eng_option import eng_option
from optparse import OptionParser

 class my_graph(gr.flow_graph):

def __init__(self):
gr.flow_graph.__init__(self)

usage="%prog: [options] output_filename"
parser = OptionParser(option_class=eng_option, usage=usage) 
parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 
0),
  help="select USRP Rx side A or B (default=A)")
parser.add_option ("-d", "--decim", type="int", default=8,
  help="set fgpa decimation rate to DECIM 
[default=%default]")
parser.add_option("-f", "--freq", type="eng_float", default=50e3, 
  help="set frequency to FREQ", metavar="FREQ")
parser.add_option("-g", "--gain", type="eng_float", default=None,
  help="set gain in dB (default is midpoint)") 
parser.add_option("-N", "--nsamples", type="eng_float", default=2000,
  help="number of samples to collect [default=+inf]")
 
(options, args) = parser.parse_args ()
if len(args) != 1:
parser.print_help()
raise SystemExit, 1

filename = args[0]

if options.freq  is None:
parser.print_help()
sys.stderr.write('You must specify the frequency with -f FREQ\n');
raise SystemExit, 1

# build the graph

 self.u = usrp.source_c(decim_rate=options.decim)

self.dst = gr.file_sink(gr.sizeof_gr_complex, filename)

self.head = gr.head(gr.sizeof_gr_complex, int(options.nsamples))
 
self.connect(self.u, self.head, self.dst)

  
rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
self.u.set_mux(usrp.determine_rx_mux_value(self.u, 
options.rx_subdev_spec)) 

# determine the daughterboard subdevice we're using
self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
print "Using RX d'board %s" % (self.subdev.side_and_name (),)
input_rate = self.u.adc_freq() / self.u.decim_rate()
print "USB sample rate %s" % (eng_notation.num_to_str(input_rate))
print "Freq is set to: %s" % (options.freq) 

if options.gain is None:
# if no gain was specified, use the mid-point in dB
g = self.subdev.gain_range()
options.gain = float(g[0]+g[1])/2

self.subdev.set_gain (options.gain)

r = self.u.set_rx_freq (0, options.freq) #self.u.tune(0, self.subdev, 
options.freq)
if not r:
sys.stderr.write('Failed to set frequency\n')
raise SystemExit, 1 


if __name__ == '__main__':
try:
my_graph().run()
except KeyboardInterrupt:
pass
==

 MATLAB

ms = 1e-3; 
kHz = 1e3; 
 
 
count = 2000; 
decim_rate = 8; 
Fsamp = 64e6; 
Fsamp_real = Fsamp./decim_rate; 
 
%set the time axis 
dt = 1./Fsamp_real; 
T_end = count./Fsamp_real; 
t = 0:dt:T_end-dt; 
%t = dt:dt:T_end; 
 
 
df = fopen('signal_samples.dat'); 
y = fread (df,[2, count], 'float'); 
fclose(df); 
 
 
%plot I and Q 
figure (1) 
subplot(211) 
plot(t/ms,y(1,:)); 
grid on; 
xlabel('ms') 
title ('I data') 
subplot(212) 
plot(t/ms,y(2,:)); 
grid on;

Re: [Discuss-gnuradio] Signal reconstruction

2007-11-08 Thread Martin Dvh
Aadil Volkwin wrote:
> Hi,
> 
> I've been bashing my head for a couple of days on what should be a trivial
> process.
> I would really appreciate it if somebody could please come to my rescue.
> 
> I'd like to digitise a signal, intented to be off air FM signal, but for the
> moment, i'm capturing a 50KHz sinusiod and doing the reconstruction in
> MATLAB to test that im capturing the samples correctly.
> 
> on plotting the FFT in MATLAB, it's clear that something's a miss...I don't
> know where :/ i've been at this for ages!!!
Can you describe what is miss with what you see.
It would help if you could make some screenshots of yout matlab plots available 
on some website.
(Please don't send them as attachments to the list)

If you run usrp_oscope.py or usrp_fft.py does your signal look OK?
If it does then probably matlab does not read in your samples the right way.
I can imagine that matlab gets the order of I and Q wrong  (I=Q and Q=I)
Or do you have the axis right
I don't know if it should be
> y = fread (df,[2, count], 'float');
or maybe
> y = fread (df,[count, 2], 'float');

Greetings,
Martin

> here's my code: I really hope somebody can help, I know this should be a
> simple matter. The Matlab code follows below the Python stuff.
> 
> =
> 
> #!/usr/bin/env python
> 
> """
> Read samples from the USRP and write to file formatted as binary
> outputs single precision complex float values or complex short values
> (interleaved 16 bit signed short integers).
> 
> """
> 
> from gnuradio import gr, eng_notation
> from gnuradio import audio
> from gnuradio import usrp
> from gnuradio.eng_option import eng_option
> from optparse import OptionParser
> 
> class my_graph(gr.flow_graph):
> 
> def __init__(self):
> gr.flow_graph.__init__(self)
> 
> usage="%prog: [options] output_filename"
> parser = OptionParser(option_class=eng_option, usage=usage)
> parser.add_option("-R", "--rx-subdev-spec", type="subdev",
> default=(0, 0),
>   help="select USRP Rx side A or B (default=A)")
> parser.add_option("-d", "--decim", type="int", default=8,
>   help="set fgpa decimation rate to DECIM
> [default=%default]")
> parser.add_option("-f", "--freq", type="eng_float", default=50e3,
>   help="set frequency to FREQ", metavar="FREQ")
> parser.add_option("-g", "--gain", type="eng_float", default=None,
>   help="set gain in dB (default is midpoint)")
> parser.add_option("-N", "--nsamples", type="eng_float",
> default=2000,
>   help="number of samples to collect
> [default=+inf]")
> 
> (options, args) = parser.parse_args ()
> if len(args) != 1:
> parser.print_help()
> raise SystemExit, 1
> 
> filename = args[0]
> 
> if options.freq is None:
> parser.print_help()
> sys.stderr.write('You must specify the frequency with -f
> FREQ\n');
> raise SystemExit, 1
> 
> # build the graph
> 
> self.u = usrp.source_c(decim_rate=options.decim)
> 
> self.dst = gr.file_sink(gr.sizeof_gr_complex, filename)
> 
> self.head = gr.head(gr.sizeof_gr_complex, int(options.nsamples))
> 
> self.connect(self.u, self.head, self.dst)
> 
> 
> rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
> self.u.set_mux(usrp.determine_rx_mux_value(self.u,
> options.rx_subdev_spec))
> 
> # determine the daughterboard subdevice we're using
> self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
> print "Using RX d'board %s" % (self.subdev.side_and_name(),)
> input_rate = self.u.adc_freq() / self.u.decim_rate()
> print "USB sample rate %s" % (eng_notation.num_to_str(input_rate))
> print "Freq is set to: %s" % (options.freq)
> 
> if options.gain is None:
> # if no gain was specified, use the mid-point in dB
> g = self.subdev.gain_range()
> options.gain = float(g[0]+g[1])/2
> 
> self.subdev.set_gain(options.gain)
> 
> r = self.u.set_rx_freq (0, options.freq) #self.u.tune(0, self.subdev,
> options.freq)
> if not r:
> sys.stderr.write('Failed to set frequency\n')
> raise SystemExit, 1
> 
> 
> if __name__ == '__main__':
> try:
> my_graph().run()
> except KeyboardInterrupt:
> pass
> ==
> 
> MATLAB
> 
> ms = 1e-3;
> kHz = 1e3;
> 
> 
> count = 2000;
> decim_rate = 8;
> Fsamp = 64e6;
> Fsamp_real = Fsamp./decim_rate;
> 
> %set the time axis
> dt = 1./Fsamp_real;
> T_end = count./Fsamp_real;
> t = 0:dt:T_end-dt;
> %t = dt:dt:T_end;
> 
> 
> df = fopen('signal_samples.dat');
> y = fread (df,[2, count], 'float');
> fclose(df);
> 
> 
> %plot I and Q
> figure (1)
> subplot(211)
> plot(t/ms,y(1,:));
> grid on;
> xlabel('ms')