wrote:
Thanks Bob, that clarifies -Inf values. And also seems logical.
One query still remains, why isn't there -Inf values for 'Expected Output'.
Please forgive me, but that's the "wrong question". Almost all of the values in Expected Output (as are almost all the values in the other outputs) -inf, except for rounding errors (note that -400 dB represents a value that is about as close as you can come to Floating Point Zero with a few low-order bits not quite cancelling out. If you do the "clipping" trick that fixed up the Actual Plots, you'd see that the "Expected" plots look the same.
So the right question is "Why does generating a 4000-point waveform all at once different from generating 4 identical sub-waveforms and concatenating them?". I honestly have no idea, but it could be that after 4000 iterations, the tiny rounding errors involved with adding dt to itself 4000 times "drifts" sufficiently to give the difference you are observing. I'd bet if you generated one 10Hz waveform with 100 points and replicated it 40 times (instead of 10-at-a-time replicated 4 times, or 40-at-a-time, replicated once) you'd get yet another result.
Make yourself a 72-point Bold Card that says "Floating Point Values Are Necessarily Approximations". Remember this when doing numerical computations. In particular, when doing comparisons of Floating Point values, never use "Is Equal", instead use "Absolute Value of Difference Is Less Than Or Equal To" and put in your "epsilon", a "precision" number that makes sense with respect to your problem, but is (a) positive and (b) non-zero.
Bob Schor