How can I do a Fourier expansion for a waveform with uneven square pattern

103 Views Asked by At

The pattern of the wave is as follows:

  1. 0.0 - 0.5 => low,
  2. 0.5 - 1.0 => high,
  3. 1.0 - 2.0 => low,
  4. 2.0 - 2.5 => high,
  5. 2.5 - 4.0 => low,
  6. 4.0 - 4.5 => high,
  7. 4.5 - 6.5 => low,
  8. 6.5 - 7.0 => high,

enter image description here

The pulses are equal but the time between different pulses increases as follows: 0.5, 1.0, 1.5, 2.0. This pattern repeats itself so that if we keep going the next iteration would look like this:

  1. 7.0 - 7.5 => low,
  2. 7.5 - 8.0 => high,
  3. 8.0 - 9.0 => low,
  4. 9.0 - 9.5 => high,
  5. 9.5 - 11.0 => low,
  6. 11.0 - 11.5 => high,
  7. 11.5 - 13.5 => low,
  8. 13.5 - 14.0 => high,

enter image description here

I'm a total noob when it comes to Math.

1

There are 1 best solutions below

1
On

While not the Fourier expansion the OP asked for originally, here's an alternate approach which may be what is actually wanted.

The following Mathematica code produces the output shown

f[x_] := With[{r = Mod[x,7]},
    Boole[.5<r<1||2<r<2.5||4<r<4.5||6.5<r<7]];
Plot[f[x], {x,-.5,14.5}, PlotRange->{-.1,1.1}]

Mathematica graph plot

Similar code can be easily written in any other language. Note that Boole[x] returns $1$ if $x$ is true and $0$ if $x$ is false.