mathnet / mathnet-numerics

Math.NET Numerics
http://numerics.mathdotnet.com
MIT License
3.44k stars 891 forks source link

Numerics.Generate.Periodic amplitude parameter description seems off? #975

Open erikthysell opened 1 year ago

erikthysell commented 1 year ago

In Numerics.Generate.Periodic the parameter amplitude description seems to be incorrect (line 331):

<param name="amplitude">The length of the period when sampled at one sample per time unit. This is the interval of the periodic domain, a typical value is 1.0, or 2*Pi for angular functions.</param>

For me, amplitude has nothing to do with length of a period but with the "level" of a signal.

I do not entirely understand the implementation and I do not know if I just misunderstand something here.

cdrnet commented 1 year ago

It is indeed confusing, since it is assuming a context which is not actually stated, and also not always relevant.

The idea behind these generate functions is, among others, to drive other functions as input. With Periodic you can then sample any function periodically - where amplitude is then indeed the length of the period (or interval) sampled from that other function. Note also that often that amplitude value is never actually reached, depending on the other parameters - which is fine in this context, but maybe not if you indeed intended it to be an amplitude of a saw-tooth curve.

Maybe we should split this into a saw-tooth curve (with different more straight forward parameters), and one for periodically sampling another function, and then make the description much clearer.

erikthysell commented 1 year ago

Thanks. To be more clear - I am looking for a c# equivalent of the Matlab sawtooth function.