Friday, November 8, 2013

Fourier Series: Several functions




Second post dedicated to the Fourier series [Link] with several examples of classical periodic functions.


1- Triangle wave

The formula is:

f x = 4 π ( 1 9 cos(3x) + 1 25 cos(5x) + ... + 1 n 2 cos(nx) )
Or can be written like this...
f x = 4 π k = 1 cos(2k+1) . x (2k+1) 2

and the corresponding macro...

+++ IJ snippet: Triangle_wave_fourier_series.ijm +++
+++ End of IJ snippet +++

 To create the triangle wave, select the whole image (Ctrl+A) then compute the profile (Analyze > Plot Profile or Ctrl +K).

Fig. 1: Triangle wave obtained from the sum of each row of the Fourier Series.

2- Sawtooth wave
Another function defined by ...

f x = 2 π ( sinx - 1 2 sin(2x) + 1 3 sin(3x) - 1 4 sin(4x) + ... + (-1)n+1 1 n sin(nx) )

The following video shows the evolution of the resulting curve when we add more components.


3- JavaScript

Here is a small script containing all the various functions previously described. For sake of convenience, this script is written in JavaScript but uses exactly the same function Process > Math > Macro...

+++ IJ JavaScript snippet +++ +++ End of IJ JavaScript snippet +++

4- Links


Square wave image [Link]

No comments:

Post a Comment