Finding Standard Deviation Using Array and Function
Hello.
I opened a topic before but people misunderstood my question.
I have to create a program that computes Standard Deviation of a group of numbers when Button1 is clicked. On button click, Inputbox asks for how many numbers in the group and then the calculated stDev Result should be shown in textbox1.
In the coding part, Calculation part should be made in function and the function should bring the answer in textbox1. ( Example: Textbox1.text = StDevFunc(array) )
I managed to write a code without using Function. All I need to do is to create a function and bring the calculation part inside function and then call the function when textbox1.text = answer
Obligations:
1.Array must be used.
2.Function must be used
Quote:
Dim a,sum,sserror,fvar,dSD As Decimal
Integer.Tryparse(Inputbox("Enter number"),a)
a = int(Rnd()*100)
Dim array(a-1) As Integer
For i=0 to a-1
array(i) = 5
Next
For j=0 to a-1
sum = sum + array(j)
Next
avg= sum/a
For k=0 to a-1
sserror = sserror + (array(k) - avg)*2
Next
dVar= sse / a 'calculates variance
dSD = dVar / 2 ' calculates st.deviation
ALL HELP APPRECIATED AND +++++++++++
Re: Finding Standard Deviation Using Array and Function
Quote:
I opened a topic before but people misunderstood my question.
No they didn't and even if they had it wouldn't justify double posting. I provided a full working solution on the previous thread.
Re: Finding Standard Deviation Using Array and Function
Quote:
Originally Posted by
dunfiddlin
No they didn't and even if they had it wouldn't justify double posting. I provided a full working solution on the previous thread.
The answer part should be something like this
Quote:
stDevFunction
---------------
Dim a,sum,sserror,fvar,dSD As Decimal
Integer.Tryparse(Inputbox("Enter number"),a)
a = int(Rnd()*100)
Dim array(a-1) As Integer
For i=0 to a-1
array(i) = 5
Next
Textbox1.text = stdevfunction(array)
Why are you so mean man sorry If I made you angry
Re: Finding Standard Deviation Using Array and Function
Quote:
Textbox1.text = stdevfunction(array)
Line 10 of the solution I posted ....
vb.net Code:
Me.Text = StandardDeviation(test).ToString ' function
.. where Me is the form but could be any text control and test is the array. What did I miss?
Re: Finding Standard Deviation Using Array and Function
I am a total idiot sorry. THANK YOU =)
Quote:
Originally Posted by
dunfiddlin
Line 10 of the solution I posted ....
vb.net Code:
Me.Text = StandardDeviation(test).ToString ' function
.. where Me is the form but could be any text control and test is the array. What did I miss?