|
-
May 21st, 2013, 05:13 PM
#1
Thread Starter
Junior Member
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
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 +++++++++++
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|