Fourier DFT transformation of sawtooth wave (0, a, 2 a, 3a..a*(N-1).) has coefficients
aN(N+1)2,k=0
−aN1−e−j2πk/N, k∈[1,N−1]
I want remove it from samples, but I must compute optimal slope a.
X means Fourier transformation of samples, S - Fourier transformation of sawtooth wave
Slope is optimal when difference (X-S) has minimum high frequencies <=>
∑frequencies(frequency⋅amplitude2) is minimal.
Maybe better ∑frequencies(frequency2⋅amplitude2) is minimal.
I must equate to zero the derivative of this sum and compute slope a. How do it with SageMath?