Octave

= Octave and Matlab =

Octave is the most popular analysis tool with GNU Radio, as the GNU Radio package includes its own set of scripts for reading and parsing output.

Matlab is a closed source tool, and very expensive--but if you already have it installed, you might prefer it to Octave.

Installing
Installing Octave can be done from source, or in Ubuntu using:

sudo apt-get install octave To use the GNU Radio octave scripts, you must add the path to your Octave path variable. This is easily done using your local ~/.octaverc configuration file. If you check out the GNU Radio trunk to /home/username/gnuradio/, you can add the following to ~/.octaverc:

addpath(&quot;/home/username/gnuradio/gr-utils/octave&quot;)

Parsing Data
To parse data output from GNU Radio, the easiest thing to do is use the provided scripts. Ensure that you have added the GNU Radio script path to your octave path, as described in the installing guide. These help you read data that you may have dumped to disk using gr.file_sink(size, filename).

You want to use one of the following methods, based on the size parameter used in gr.file_sink. Each method takes a filename as the first parameter, and an optional second parameter which is the number of items to read from the file:

 _read_complex_binary_: gr.sizeof_gr_complex

 _read_float_binary_: gr.sizeof_float

 _read_int_binary_: gr.sizeof_int

 _read_short_binary_: gr.sizeof_short

 _read_char_binary_: gr.sizeof_char

For example, after capturing 64-bit complex using gr.file_sink(gr.sizeof_gr_complex, &quot;capture.dat&quot;) in a Python script:

c=read_complex_binary('capture.dat'); Data captured directly from the USRP is stored as 32-bit complex, rather than 64-bit complex (gr.sizeof_gr_complex). To read this data, first use read_short_binary and then split it into a two dimensional vector:

d=read_short_binary(data); c=split_vect(d,2); This works for both Octave and Matlab.

Plotting
To plot data using octave, it is easiest to do with gnuplot. You can install GNU plot from source or using the Ubuntu repository:

sudo apt-get install gnuplot To plot I and Q separately over time, graph each component separately:

plot([real(c), imag(c)]) Generating an I/Q plot (x-axis I, y-axis Q) can be done using:

plot(c)

Using Python as an alternative to Octave and Matlab
Most likely you have several scientific Python libraries installed, such as SciPy and NumPy components (in particular, Matplotlib. With these tools, you can use Python to plot and analyse data.