File Exchange Pick of the Week

Our best user submissions

AIS Decoder

Idin‘s pick this week is AIS Decoder by our former colleague Mike Donovan.

This example shows how to decode automatic identification system (AIS) signals sent out by commercial ships. The AIS standard was developed in the late 1990s and early 2000s. It is widely in use today for larger ships. See here for details.

Why this example?

I like this example for several reasons:

  1. It involves modeling a digital communications standard that is simple to understand by anyone who has basic knowledge of communications theory (in contrast to most commercial wireless standards today such as WiFi, LTE, or Bluetooth that are quite complex). Despite its relative simplicity, AIS does not make any “simplifying assumptions” (as one might do in an academic setting). It deals with all aspects of a modern communication system, as a commercial standard would need to do. However, it does not involve the layers of complexity that inevitably appear in high-throughput multi-user systems like LTE or 5G.
  2. It shows how MATLAB can be used to model both transmitter and receiver for complete communication system (AIS in this case).
  3. It uses the RTL-SDR radio. In my opinion, every wireless communications student should own at least one of these:
    For about $20 you get a fully functional radio (albeit receive only). You can then download the MathWorks’ hardware support
    package for this radio, and start playing around with interesting signals (like AIS, ADS-B, or just plain old FM radio).
  4. It actually inspired a fully polished example that now ships as part of MathWorks’ support package for RTL-SDR: We are always looking for good examples that we can package with our toolboxes and support packages. The AIS decoder was just such an example. It was originally developed by one of our field engineers as a simple demo, but eventually made its way into our commercial shipping product. The shipping example uses a lot of the same code that Mike Donovan had created, but with a slightly different interface (plus more error checking, etc., that you would expect from a commercial software

Run the example

To run the example, you will need to have the RTL-SDR support package installed (otherwise it errors out). Mike has included a nice app with this example, and also documentation as a PDF. When you run the app, and everything works, you get beautiful visualizations:

The only issue with this app is that it always tries to connect to the RTL-SDR radio. So if you don’t have the RTL-SDR radio, you will need to do some digging to figure out how to run the example using just the captured data (captured data files are included with the example).

The shipping example that comes with MathWorks’ RTL-SDR support package has a command-line interface, but it makes it easier to work with previously captured data. This feature is particularly useful if you don’t have an RTL-SDR, or if you’re not near a seaport with large ships!

Mike’s example also uses Google Earth to visualize the location of the ships on a map (it’s quite nice!). The shipping example
with RTL-SDR support package uses MathWorks’ Mapping Toolbox to do the same. So depending on which mapping tool you have installed, one of these examples might be easier/nicer to use. Since I work for MathWorks, Mapping Toolbox is always installed on my machine, and you see its results below.


As always, your thoughts and comments are greatly appreciated.

Published with MATLAB® R2019a

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.