function C = sg_coefficients(n, order)if(mod(n, 2) == 0) disp('The number of coefficients must be odd'); return;end%assemble the column vector based on positionsr = floor(n/2); %maximum extent around zero (0)x = -r:1:r;%calculate JJ = zeros(n, order + 1);%columns values are 1, x_i, x_i^2, ...for i = 1:order+1 J(:, i) = (x').^(i-1);endC = (J' * J)^(-1) * J';