If your signals are reliably smooth, you could probably just look at the autocorrelation function for each trial and pick the set the order as the lag when the ACF starts to decay.
autocorr(Y);
If you want to get a more quantitative fit (which is probably easier than eyeballing and generalizing 129 signals). You can fit an AR model
First thing you'll do is choose the order range you want to evaluate (I would look at the ACF for a couple of signals and pick an order where there's relatively no signal in the ACF).
bounds = 1:12; % Order bounds
Now you'll iterate through each order possibility and compute the AIC, BIC. Lower values == better fit.
for p = bounds
myModel = arima(p,0,0); % no moving average (I'm not sure about no MA...)
for sig_ind = 1:size(sig_mat,2)
% Get the log likelihoods
[~,~,LL(p,sig_ind)]= estimate(myModel,sig_mat(:,sig_ind));
end
end
for sig_ind = 1:size(sig_mat,2)
[aic(sig_ind,:),bic(sig_ind,:)] = aicbic(LL(:,sig_ind),bounds,size(sig_mat,1));
end
So now you have your BIC scores you want to pick the lowest.
In this case I use the mean across signals, if you want to be
real careful I would look at the distributions and pick a low
median with a tight distribution. You could also use the AIC to evaluate.
[~,order_ind] = min(mean(bic,1));
order = bound(order_ind);