MATLAB AIS Example Decoder Function Error

6 views (last 30 days)
Hamza
Hamza on 12 Jun 2025
Answered: Shlok on 16 Jul 2025
In MATLAB AIS Example " Ship Tracking Using AIS Signals " , the decoding part which is coded in helperAISRxPhyBitParser function, the Message ID is decoded as (% Decode message type msgID = bit2int(payloadBits(3:8),6,false);), However as per ITU Rec 1371-5 standard , the message ID bits are from 1 to 6 but the function decode bits from 3 to 8. This difference is unclear, can anyone help me out with understanding this?

Answers (1)

Shlok
Shlok on 16 Jul 2025
Hi Hamza,
From what I understand, the ITU-R M.1371-5 specification (as described in Section 5.1 of this document) defines the Message ID as occupying bits 1-6 of the AIS message, immediately followed by the Repeat Indicator in bits 7-8.
In the MATLAB AIS example, the bitstream is first processed by removing the 8-bit start flag. The resulting "payloadBits" then begins at position 1. Based on the indexing used in the code, my understanding is that the first two bits represent the Repeat Indicator and are intentionally skipped during decoding. As a result, bits 3 to 8 in "payloadBits" are used to extract the Message ID, which would align with the standard’s bit positions 1-6.

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!