Re: Finding simplest Fourier series between two given Fourier series
- To: mathgroup at smc.vnet.net
- Subject: [mg105689] Re: Finding simplest Fourier series between two given Fourier series
- From: dh <dh at metrohm.com>
- Date: Tue, 15 Dec 2009 07:28:24 -0500 (EST)
- References: <hg4h4h$gib$1@smc.vnet.net>
Hi Kely,
this is a tough question because your conditions are formulated in two
different domains, let's call them time and frequency space.
Here is a simple approach that may not always give satisfactory results:
- calculate the mean of both functions: f3 = 0.5(f1+f2)
- Get the FFT of f3: fft[f_]
- truncate the highest order term of fft[] and check if the
corresponding function in time space is still between f1 and f2
- keep on doing the above until the fft can no more be truncated due to
condition: I
Here is a much more complicated and laborious approach:
- let ndat= 2 n+1 be the number of data points
- calculate the mean of both functions: f3 = 0.5(f1+f2)
- Get the FFT of f3: fft[f_]:= Sum[f3[i] Exp[-I 2 Pi f i/ndat],{i,0,ndat-1}]
- choose the max. number: 1+2 nmax of non zero fourier coef. of the
searched function (may be changed later)
- consider a polynomial p[z_]:=Sum[a[i] z^i],{i,-nmax,nmax}] of a
complex variable z.
For points on the unit circle we may define:
pu[f_]:=p[Exp[I 2Pi f]] for f==-1/2..1/2
We may imagine this to be the fourier transform of the searched real
function. Therefore a[i]== ComplexConjugate[a[-i]].
- We now choose a[i] so that pu[f] approximates fft[f]. Toward this aim
we minimize some error criterion. We may e.g. choose some points on
the unit circle given by fi: Exp[I 2Pi fi], fi==-1/2..1/2 and evaluate
err[fi_]:=p[fi]-fft[fi] at these points.
We may get different fits (e.g. least square or 1-norm) by choosing a
corresponding norm of the error vector err[fi]= error evaluated at all
chosen points on the unit circle:
Norm[err[fi]]
- to ensure that f1<f3<f2 we increase the above error by a huge penalty
if the back transformed function is outside this band.
- having got the optimal function, reduce the number of non zero terms
in the p[z] and repeat the above.
Daniel
Kelly Jones wrote:
> Given two Fourier series f1[x] and f2[x], where f1[x]<=f2[x] for all
> x, I want Mathematica to find the "simplest" Fourier series f3[x] that
> lies between them. More specifically:
>
> I. f1[x] <= f3[x] <= f2[x] for all x
>
> II. f3[x] has the fewest non-zero coefficients of all f3 meeting I.
>
> III. If multiple functions meet I and II, choose the one whose
> highest term is smallest (ie, the "least wiggly" one).
>
> If multiple Fourier series satisfy I, II, and III, I'll settle for any
> of them.
>
> Motivation:
>
> % I'm Fourier-fitting continuous cyclic data that's measured to the
> nearest integer. IE, a datum of 56 means the value I'm measuring is
> between 55.5 and 56.5.
>
> % Using Fourier series, I can approximate the measured data to
> arbitrary precision, but this feels silly when the terms are of order
> 0.1, 5 times smaller than the measurement precision.
>
> % I believe the data satisfies a fairly simple Fourier relation
> that's being obscured by rounding/measurement precision.
>
> "Extra credit": The data I'm measuring is cyclic, but I'm not
> necessarily feeding Mathematica an integral number or cycles. The list
> I give Mathematica may have 57.2 cycles instead of 57 or 58. The ideal
> solution would compensate for this, though I'd be happy w/ a solution
> that just works for an integral number of cycles.
>