To determine the order of the Auto-Regressive (AR) model and find the coefficients for your EMG signal, you can use criteria such like Akaike Information Criterion (AIC).
You can do something like this:
% Assuming emg_signal is your EMG data
% Determine the order of the AR model using AIC
max_order = 20; % Maximum order to consider
aic = zeros(1, max_order);
for order = 1:max_order
model = ar(emg_signal, order, 'aic');
aic(order) = model.Report.Fit.AIC;
end
% Find the order with the minimum AIC
[~, best_order] = min(aic);
% Estimate the AR coefficients
[ar_coeffs, noise_variance] = aryule(emg_signal, best_order);
Please refer to the following documenation links for more information:
Hope it helps!