# How to calculate standard deviation from the delay?

I am trying to calculate the unit vector and standard deviation of the signal. I hope everyone can give me ideas.

Here is my scenario:

I have 2 rx channels: - f is channel 1 with the length 1x256 complex, then FFT. - g is channel 2 with the length 1x256 complex, then FFT. - from f and g, I can calculate the spectrum density S_fg = f * conj(g), with the length 1x256 complex

S_fg = f * conj(g)
t_0 = 1 / f_0;
r_0 = t_0 / (2 * pi);
delay = angle(S_fg) * r_0 * 1e12; % in pico second
d = median(delay);

since I have those parameters, How can i calculate the unit vector (x,y), and standard deviation?

The unit vector maybe calculated by the equation:
x = 1*cos(delay); % 1x256
y = 1*sin(delay); % 1x256

but I do not know how to get the standard deviation?

Hope anyone can help?

Baluncore
I think you have gone too far. Find the delays, x, then accumulate the sums of x and of x2.
For i = 1 to 256
Sum_x += x(i)
Sum_xx += x(i)2
Next i

The average delay is; mean_delay = Sum_x / n
The sample standard deviation is; Ssd = √( (Sum_xx – (sum_x)2 / n ) / (n – 1) )

• Nate Duong, jim hardy and dlgoff
I think you have gone too far. Find the delays, x, then accumulate the sums of x and of x2.
For i = 1 to 256
Sum_x += x(i)
Sum_xx += x(i)2
Next i

The average delay is; mean_delay = Sum_x / n
The sample standard deviation is; Ssd = √( (Sum_xx – (sum_x)2 / n ) / (n – 1) )
@Baluncore: I agree with your equations, is it gonna be the same when I calculate for y and xy values?
The average delay is; mean_delay = Sum_y / n
The sample standard deviation is; Ssd = √( (Sum_yy – (sum_y) / n ) / (n – 1) )

Baluncore
The sample standard deviation is; Ssd = √( (Sum_yy – (sum_y) / n ) / (n – 1) )
Don't forget to square the Sum_y in the Ssd equation. (sum_y)2 / n.

The application to independent x and y axes is not a problem.
The resulting means Mx and My make a mean vector M. Likewise, SDx and SDy make an SD vector.
I have not thought through the signal implications of ∑(xy) and ∑(x2y2), but I see no reason why it cannot be done.

The mean and SD equations I gave are the same as those used in HPs RPN calculators by the ∑+ and ∑– key functions. Counting the number of samples n, and the accumulation of ∑x, ∑x2, ∑y and ∑y2 can all be done for the independent x and y axes in a single pass. The method has the huge advantage of not needing to store the input data set until the mean is known.

• Nate Duong
Don't forget to square the Sum_y in the Ssd equation. (sum_y)2 / n.

The application to independent x and y axes is not a problem.
The resulting means Mx and My make a mean vector M. Likewise, SDx and SDy make an SD vector.
I have not thought through the signal implications of ∑(xy) and ∑(x2y2), but I see no reason why it cannot be done.

The mean and SD equations I gave are the same as those used in HPs RPN calculators by the ∑+ and ∑– key functions. Counting the number of samples n, and the accumulation of ∑x, ∑x2, ∑y and ∑y2 can all be done for the independent x and y axes in a single pass. The method has the huge advantage of not needing to store the input data set until the mean is known.
@Baluncore: thank you very much for this thread, Baluncore !