.NET C# Java Javascript Exception

i am trying to create for a given array two new arrays which are then used as tolerance-lines for limit-check.

This should run in three steps
1. The first function captures a waveform (from a scope) of a good part - this is what i already have.
IN: -
Out: double[] Waveform

2. Then the second function gets this “good” waveform plus two Delta-values and should create two output-tolerance-arrays
IN: double[] Waveform
int Delta-X
double Delta-Y

OUT: double[] UpperLimitLine
double[] LowerLimitLine

3. Now I capture again a waveform of a new part and compare its waveform against the two tolerance-arrays that were previously created.
IN: double[] Waveform
double[] UpperLimitLine
double[] LowerLimitLine

OUT: bool Result (is True if Waveform is between the limits)

If I only do a simple + and – for each point in the first array then this of course also generates two limit-lines BUT if there is a very small peak in the array then this is not working any more.
Imagine we have a measurement of 1000 points which is always 0 – only at point 500 the value is 10.
This means now that all other measurements also must have the peak at exactly point 500 to pass the tolerance-check.

This is why I need to have two delta-values to make the limit-array also wider to the left and right side and not only up and down.

The problem is: How can i do this with C#?

Thanks for all help
T.Mann11 43 1 5
LiRo 1,3k 1 9