The Nt seems to be the number of harmonics, if I am not misinterpreting it.
Why for the first harmonic Nt should be 2?
Nt shouldn't it be 1 for the first harmonic?
The image above shows the first harmonic and for that Nt needs to be equal with 2.
Your sheet calculates the first two harmonics of the signal.
BUT, the Fourier sequence of a square wave only contains odd harmonics. So from the first 2 harmonics only the first is (and should be !) visible. The second harmonic is zero.
If you set Nt:=3 I suspect that you should see the result of first and third harmonics added.
Success!
Luc
I know that the square wave signal has only the odd harmonics, but the first harmonic is the first harmonic, and it is odd:).
What it's your opinion about this sequence?
My conclusion: There's a 2 missing in each of the sin() and cos() arguments of the Fourier functions that you are using.
The correct function to create a sine of frequency F is not sin( pi * F * t) but sin(2 * pi * F * t).
Now your n has to step twice as much paces to run past all harmonics.
Success!
Luc