Files
CheryFianlAssemblyLineNew/Analysis/Define/MyExtensions.cs
T
HM-CN\zhengxuan.zhang 8cf3fb42d6 #总装移交版本
2025-03-07 11:44:37 +08:00

18 lines
468 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NSAnalysis
{
public static class EnumerableExtensions
{
public static double StandardDeviation(this IEnumerable<double> values)
{
double avg = values.Average();
double sum = values.Sum(d => Math.Pow(d - avg, 2));
return Math.Sqrt((sum) / (values.Count() - 1));
}
}
}