function [y,yhat] = saw(x,M) % [0,1] periodic sawtooth with max at 0, min at 0.5 % Returns gridpoint values y and Fourier coeffs yhat at gridpoints x % uniformly spaced over [0,1). y = abs(2*x - 1) - 0.5; yhat = 2*mod(M,2)./(pi*M).^2;