Maximum Amplitude and Frequency calculation.

This is a Code from Renaldas, a programmer in the discussion forum who is helping us.
I tested the first version but there was a bug in it, this version is yet to be tested.