function allpole_features = calc_allpole(in,order)
%function allpole_features = calc_alpole(in,order)
%
% CALC_ALLPOLE  --  
%
%
% Input Parameters:
%   in        --  The input vowel signal.  If 'in' is a matrix, the function 
%                 assumes one signal per row and computes all-pole features
%                 for each signal.
%   order     --  Order of the resulting automatic all pole models
%
% Output Parameters:
%   allpole_features -- A matrix of the allpole features, with row per row of
%                       the matrix 'in'.  Each column corresponds to one instance.

if nargin < 2
    order = 10;
end

% Make sure the input is oriented properly
if any(size(in)==1)
    in = in(:)';
end

for i=1:size(in,1);

    % Calculate the all-pole model
    allpole = aryule(in(i,:),order);
    
    % Calculate spectrum of all-pole model
    allpole_features(i,:) = 20*log10(abs(freqz(1,allpole,16)))'; 
    
end
