Migrated coefficients from MATLAB to C++, having trouble making sure of the order