File Exchange

image thumbnail

AIS Decoder

version (1.97 MB) by Mike Donovan
This submission provides an app and the source code to decode AIS transmissions using the RTL-SDR.


Updated 14 Dec 2016

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Commercial and recreational marine vessels use a communications standard called Automatic Identification System (AIS) to report their ID, position, course, speed, destination and other relevant data to coastal base stations, aids to navigation, search and rescue aircraft and other vessels. This information can be received by many Software Defined Radio platforms, including the low-cost RTL-SDR. MATLAB can be used to demodulate and decode these captured signals and extract the information fields from the AIS messages. This app has been used to decode transmissions from ships in New York City, Boston Harbor and San Francisco Bay at a distance of up to 8 miles.
The source code for the AIS Receiver and an AIS Transmitter are provided. Capture logs and raw data files are also provided.
See the included file AIS_Decoder_Instructions.pdf for more information on how to use the app and source code.

Cite As

Mike Donovan (2021). AIS Decoder (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

Nick Amadio

Nick Amadio

Is anyone able to get the ISM band tx w/ a USRP and rx w/ an RTL portion to work?

Very handy! Thanks!

Bill Sneed

Installed AIS Decoder and the RTL Add-on on ML R2019a. Decoder through errors and never worked.
More importantly for me, it completely trashed a working version of SDR#.
User beware.


A convertStringToBits function would be appreciated - in order to allow decoding of messages that are in an ASCII format.

Mike Donovan

Hi MTMCELRO - I've used this example with R2015b and it works fine. I have never tested with R2015a but believe that the example will work with any MATLAB version that supports the RTL-SDR. These demos don't use many new MATLAB features so I think older versions should work.

If you are getting errors with an R2015 MATLAB let me know and I'll try to troubleshoot.

Thanks, Mike


Is there anyway to get around only having MatlabR2015a and not 2016?


Hi Mike,

first of all thanks for your swift reply! I am by no means an AIS/Matlab expert, so any input is greatly appreciated. The AIS information contained in the data base (db) file looks as follows (can simply be saved as txt file):


From this I would like to extract Lon, Lat, Timestamp, vessel dimension etc...

Mike Donovan

Hi Oliver - I'm not sure what the .db file format is. This program decodes the raw hex characters for AIS message types 1,2,3,4,5,18,19 and 21. For message type 1, if your hex characters are: 045795448820000DCFAD7A95A22280A5FFAA098327B30A
then you can decode the message and see that the MMSI is 367350050, the Longitude is -122.4043 and the Latitude is 37.807. You can use the script aisDecodeMsg1.m to do this decoding. Hope that helps, MikeD


I have AIS data provided to me in the ITU-R M. 1371-3 format in a .db file. Can this code be used to extract e.g. MMSI No and location of the vessels for each time stamp?

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!