% ADS-B AC - dekoder vysky

% AC pole binary

% 2.2.3.2.3.4.3 / DO-260B / page 118

function [ALTITUDE]=fce_DF17_Altitude_decoder(AC)

ALTITUDE=0;
   QQ=AC(9);   
   
    if QQ==0
        ALT=zeros(1,12);   
        ALT(1:7)=AC(1:7);
        ALT(8:11)=AC(9:12);
        ALTITUDE=polyval(ALT, 2); %x100ft = v nasobcich 100ft
        ALTITUDE=ALTITUDE*100;
                
    elseif QQ==1
        ALT=zeros(1,11);
        ALT(1:7)=AC(1:7);
        ALT(8:11)=AC(9:12);
        ALTITUDE=polyval(ALT, 2); %x25ft = v nasobcich 25ft
        ALTITUDE=ALTITUDE*25;
    end
    
end