June 30th, 2010, 09:55 AM
C# ST DEV. Please Help ASAP
Guys. Im a c# noob but I really need a professional's help. I am using visual studio 2005 for a project so I dont have math.linq I need to calculate the standard deviation of a generic list of objects. The list contains just a list of float numbers, nothing too complicated. However I have never done this before so i need someone to show me that has calculated standard deviation of a generic list before. Here is my code that I tried to start on:
//this is my list of objects inside. The valve data just contains a bunch of floats.
public class ValveDataResults
private List<ValveData> m_ValveResults;
public void AddValveData(ValveData valve)
//this is the function where the standard deviation needs to be calculated:
public float LatchTimeStdev()
//below this is a working example of how to get an average or mean
//of same list and same "LatchTime" that needs to be calculated here as well.
//function to calculate average of latch time, can be copied for above st dev.
public float LatchTimeMean()
float returnValue = 0;
foreach (ValveData value in m_ValveResults)
returnValue += value.LatchTime;
returnValue = (returnValue / m_ValveResults.Count) * 0.02f;
the "Latch Time" is a float object of the "ValveData" object which is inserted into the m_ValveResults list.
thats it. any help would much be appreciated. Thanks
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.