Octave and Matlab¶
Matlab is a closed source tool, and very expensive--but if you already have it installed, you might prefer it to Octave.
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:
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, "capture.dat") in a Python script:
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:
This works for both Octave and Matlab.
sudo apt-get install gnuplot
To plot I and Q separately over time, graph each component separately:
Generating an I/Q plot (x-axis I, y-axis Q) can be done using:
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.