SoFunction
Updated on 2025-03-07

C# calculates the standard deviation equivalent to the STDEV function instance in Excel

C# calculates the standard deviation equivalent to the STDEV function instance in Excel

Updated: January 25, 2017 08:52:10 Submission: jingxian
Below, the editor will bring you an example of C# calculation standard deviation equivalent to STDEV function in Excel. The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor

Examples are as follows:

public static float StDev(float[] arrData) // Calculate the standard deviation    {
      float xSum = 0F;
      float xAvg = 0F;
      float sSum = 0F;
      float tmpStDev = 0F;
      int arrNum = ;
      for (int i = 0; i < arrNum; i++)
      {
        xSum += arrData[i];
      }
      xAvg = xSum / arrNum;
      for (int j = 0; j < arrNum; j++)
      {
        sSum += ((arrData[j] - xAvg) * (arrData[j] - xAvg));
      }
      tmpStDev = (((sSum / (arrNum - 1))).ToString());
      return tmpStDev;
    }

The above C# calculation standard deviation is equivalent to the STDEV function example in Excel. This is all the content I share with you. I hope you can give you a reference and I hope you can support me more.

  • stdev function
  • excel

Related Articles

  • Summary of C#'s method of judging character encoding (six methods)

    This article mainly introduces the method of C# judging character encoding. It summarizes and analyzes six C# judging character encoding techniques based on examples. It has certain reference value. Friends who need it can refer to it.
    2016-06-06
  • Using regular expressions to match characters in C#

    The function of regular expressions is used to describe the characteristics of a string. This article focuses on introducing the meaning of using regular expression matching characters in C#. It is very good and has certain reference value. If you need it, please refer to it.
    2018-10-10
  • Introduction to the basic usage of C# bit operators

    This article introduces the basic usage of C# bit operators, and the article introduces it in detail through sample code. It has certain reference value for everyone's study or work. Friends who need it can refer to it.
    2022-08-08
  • Method of processing non-binding columns in C#

    This article mainly introduces the method of datagridview processing non-binding columns in C#. It analyzes the usage skills of datagridview in C#. Friends who need it can refer to it.
    2015-06-06
  • C# WeChat official account development WeChat event interaction

    This article mainly introduces the development of C# WeChat public account and related information about WeChat event interaction, which has certain reference value. Interested friends can refer to it.
    2017-01-01
  • C# zxing QR code example code written

    C# zxing QR code example code, friends who need it can refer to it
    2013-03-03
  • Summary of new features in C# 7.0

    C# 7.0 adds many new features and focuses on data consumption, simplifying code and performance improvements. Next, through this article, I will introduce you to the summary of new features in C# 7.0. Friends who need it can refer to it.
    2016-08-08
  • Tutorial on how to use Application in C#

    This article mainly introduces you to the usage of Application in C#. Before introducing the usage of Application, I will introduce you to the usage of Session for your reference and learning. The introduction in the article is very detailed. If you need it, follow the editor to learn.
    2017-05-05
  • Exception and continuation processing of C# tasks

    This article mainly introduces the exception and continuation processing of C# tasks. The article introduces the example code in detail, which has certain reference learning value for everyone's study or work. If you need it, please learn with the editor below.
    2023-12-12
  • Unity's sample code to implement slot machine scroll lottery effect

    This article mainly introduces the sample code for Unity to realize the effect of slot machine scroll lottery. The sample code is introduced in this article in detail, which has certain reference learning value for everyone's study or work. Friends who need it, please learn with the editor below.
    2021-04-04

Latest Comments